@@ -35,14 +35,14 @@ public function __construct(Autoloader $autoloader)
3535 * Attempts to locate a file by examining the name for a namespace
3636 * and looking through the PSR-4 namespaced files that we know about.
3737 *
38- * @param string $file The relative file path or namespaced file to
39- * locate. If not namespaced, search in the app
40- * folder.
41- * @param string|null $folder The folder within the namespace that we should
42- * look for the file. If $file does not contain
43- * this value, it will be appended to the namespace
44- * folder.
45- * @param string $ext The file extension the file should have.
38+ * @param string $file The relative file path or namespaced file to
39+ * locate. If not namespaced, search in the app
40+ * folder.
41+ * @param non-empty- string|null $folder The folder within the namespace that we should
42+ * look for the file. If $file does not contain
43+ * this value, it will be appended to the namespace
44+ * folder.
45+ * @param string $ext The file extension the file should have.
4646 *
4747 * @return false|string The path to the file, or false if not found.
4848 */
@@ -51,7 +51,7 @@ public function locateFile(string $file, ?string $folder = null, string $ext = '
5151 $ file = $ this ->ensureExt ($ file , $ ext );
5252
5353 // Clears the folder name if it is at the beginning of the filename
54- if ($ folder !== null && $ folder !== '' && $ folder !== ' 0 ' && strpos ($ file , $ folder ) === 0 ) {
54+ if ($ folder !== null && strpos ($ file , $ folder ) === 0 ) {
5555 $ file = substr ($ file , strlen ($ folder . '/ ' ));
5656 }
5757
@@ -101,7 +101,7 @@ public function locateFile(string $file, ?string $folder = null, string $ext = '
101101 // If we have a folder name, then the calling function
102102 // expects this file to be within that folder, like 'Views',
103103 // or 'libraries'.
104- if ($ folder !== null && $ folder !== '' && $ folder !== ' 0 ' && strpos ($ path . $ filename , '/ ' . $ folder . '/ ' ) === false ) {
104+ if ($ folder !== null && strpos ($ path . $ filename , '/ ' . $ folder . '/ ' ) === false ) {
105105 $ path .= trim ($ folder , '/ ' ) . '/ ' ;
106106 }
107107
@@ -154,7 +154,7 @@ public function getClassname(string $file): string
154154 }
155155 }
156156
157- if ($ className === '' || $ className === ' 0 ' ) {
157+ if ($ className === '' ) {
158158 return '' ;
159159 }
160160
@@ -305,7 +305,7 @@ public function findQualifiedNameFromPath(string $path)
305305 */
306306 public function listFiles (string $ path ): array
307307 {
308- if ($ path === '' || $ path === ' 0 ' ) {
308+ if ($ path === '' ) {
309309 return [];
310310 }
311311
@@ -338,7 +338,7 @@ public function listFiles(string $path): array
338338 */
339339 public function listNamespaceFiles (string $ prefix , string $ path ): array
340340 {
341- if ($ path === '' || $ path === ' 0 ' || ($ prefix === '' || $ prefix === ' 0 ' )) {
341+ if ($ path === '' || ($ prefix === '' )) {
342342 return [];
343343 }
344344
@@ -368,11 +368,13 @@ public function listNamespaceFiles(string $prefix, string $path): array
368368 * Checks the app folder to see if the file can be found.
369369 * Only for use with filenames that DO NOT include namespacing.
370370 *
371+ * @param non-empty-string|null $folder
372+ *
371373 * @return false|string The path to the file, or false if not found.
372374 */
373375 protected function legacyLocate (string $ file , ?string $ folder = null )
374376 {
375- $ path = APPPATH . ($ folder === null || $ folder === '' || $ folder === ' 0 ' ? $ file : $ folder . '/ ' . $ file );
377+ $ path = APPPATH . ($ folder === null ? $ file : $ folder . '/ ' . $ file );
376378 $ path = realpath ($ path ) ?: $ path ;
377379
378380 if (is_file ($ path )) {
0 commit comments