@@ -51,12 +51,12 @@ 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 (! empty ($ folder ) && strpos ($ file , $ folder ) === 0 ) {
54+ if (! empty ($ folder ) && str_starts_with ($ file , $ folder )) {
5555 $ file = substr ($ file , strlen ($ folder . '/ ' ));
5656 }
5757
5858 // Is not namespaced? Try the application folder.
59- if (strpos ($ file , '\\' ) === false ) {
59+ if (! str_contains ($ file , '\\' )) {
6060 return $ this ->legacyLocate ($ file , $ folder );
6161 }
6262
@@ -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 (! empty ($ folder ) && strpos ($ path . $ filename , '/ ' . $ folder . '/ ' ) === false ) {
104+ if (! empty ($ folder ) && ! str_contains ($ path . $ filename , '/ ' . $ folder . '/ ' )) {
105105 $ path .= trim ($ folder , '/ ' ) . '/ ' ;
106106 }
107107
@@ -184,7 +184,7 @@ public function search(string $path, string $ext = 'php', bool $prioritizeApp =
184184
185185 if ($ prioritizeApp ) {
186186 $ foundPaths [] = $ fullPath ;
187- } elseif (strpos ($ fullPath , APPPATH ) === 0 ) {
187+ } elseif (str_starts_with ($ fullPath , APPPATH )) {
188188 $ appPaths [] = $ fullPath ;
189189 } else {
190190 $ foundPaths [] = $ fullPath ;
@@ -208,7 +208,7 @@ protected function ensureExt(string $path, string $ext): string
208208 if ($ ext ) {
209209 $ ext = '. ' . $ ext ;
210210
211- if (substr ($ path , - strlen ( $ ext )) !== $ ext ) {
211+ if (! str_ends_with ($ path , $ ext )) {
212212 $ path .= $ ext ;
213213 }
214214 }
0 commit comments