@@ -44,23 +44,23 @@ public function __construct(Autoloader $autoloader)
4444 * Attempts to locate a file by examining the name for a namespace
4545 * and looking through the PSR-4 namespaced files that we know about.
4646 *
47- * @param non-empty-string $file The relative file path or namespaced file to
48- * locate. If not namespaced, search in the app
49- * folder.
50- * @param non-empty-string|null $folder The folder within the namespace that we should
51- * look for the file. If $file does not contain
52- * this value, it will be appended to the namespace
53- * folder.
54- * @param string $ext The file extension the file should have.
47+ * @param non-empty-string $file The relative file path or namespaced file to
48+ * locate. If not namespaced, search in the app
49+ * folder.
50+ * @param non-empty-string $folder The folder within the namespace that we should
51+ * look for the file. If $file does not contain
52+ * this value, it will be appended to the namespace
53+ * folder.
54+ * @param string $ext The file extension the file should have.
5555 *
5656 * @return false|non-empty-string The path to the file, or false if not found.
5757 */
58- public function locateFile (string $ file , ? string $ folder = null , string $ ext = 'php ' )
58+ public function locateFile (string $ file , string $ folder = '' , string $ ext = 'php ' )
5959 {
6060 $ file = $ this ->ensureExt ($ file , $ ext );
6161
6262 // Clears the folder name if it is at the beginning of the filename
63- if ($ folder !== null && str_starts_with ($ file , $ folder )) {
63+ if ($ folder !== '' && str_starts_with ($ file , $ folder )) {
6464 $ file = substr ($ file , strlen ($ folder . '/ ' ));
6565 }
6666
@@ -110,7 +110,7 @@ public function locateFile(string $file, ?string $folder = null, string $ext = '
110110 // If we have a folder name, then the calling function
111111 // expects this file to be within that folder, like 'Views',
112112 // or 'libraries'.
113- if ($ folder !== null && ! str_contains ($ path . $ filename , '/ ' . $ folder . '/ ' )) {
113+ if ($ folder !== '' && ! str_contains ($ path . $ filename , '/ ' . $ folder . '/ ' )) {
114114 $ path .= trim ($ folder , '/ ' ) . '/ ' ;
115115 }
116116
0 commit comments