@@ -195,8 +195,9 @@ public function search(string $path, string $ext = 'php', bool $prioritizeApp =
195195
196196 foreach ($ this ->getNamespaces () as $ namespace ) {
197197 if (isset ($ namespace ['path ' ]) && is_file ($ namespace ['path ' ] . $ path )) {
198- $ fullPath = $ namespace ['path ' ] . $ path ;
199- $ fullPath = realpath ($ fullPath ) !== false ? realpath ($ fullPath ) : $ fullPath ;
198+ $ fullPath = $ namespace ['path ' ] . $ path ;
199+ $ resolvedPath = realpath ($ fullPath );
200+ $ fullPath = $ resolvedPath !== false ? $ resolvedPath : $ fullPath ;
200201
201202 if ($ prioritizeApp ) {
202203 $ foundPaths [] = $ fullPath ;
@@ -273,14 +274,16 @@ protected function getNamespaces()
273274 */
274275 public function findQualifiedNameFromPath (string $ path )
275276 {
276- $ path = realpath ($ path ) !== false ? realpath ($ path ) : $ path ;
277+ $ resolvedPath = realpath ($ path );
278+ $ path = $ resolvedPath !== false ? $ resolvedPath : $ path ;
277279
278280 if (! is_file ($ path )) {
279281 return false ;
280282 }
281283
282284 foreach ($ this ->getNamespaces () as $ namespace ) {
283- $ namespace ['path ' ] = realpath ($ namespace ['path ' ]) !== false ? realpath ($ namespace ['path ' ]) : $ namespace ['path ' ];
285+ $ resolvedNamespacePath = realpath ($ namespace ['path ' ]);
286+ $ namespace ['path ' ] = $ resolvedNamespacePath !== false ? $ resolvedNamespacePath : $ namespace ['path ' ];
284287
285288 if ($ namespace ['path ' ] === '' ) {
286289 continue ;
@@ -332,8 +335,9 @@ public function listFiles(string $path): array
332335 helper ('filesystem ' );
333336
334337 foreach ($ this ->getNamespaces () as $ namespace ) {
335- $ fullPath = $ namespace ['path ' ] . $ path ;
336- $ fullPath = realpath ($ fullPath ) !== false ? realpath ($ fullPath ) : $ fullPath ;
338+ $ fullPath = $ namespace ['path ' ] . $ path ;
339+ $ resolvedPath = realpath ($ fullPath );
340+ $ fullPath = $ resolvedPath !== false ? $ resolvedPath : $ fullPath ;
337341
338342 if (! is_dir ($ fullPath )) {
339343 continue ;
@@ -366,8 +370,9 @@ public function listNamespaceFiles(string $prefix, string $path): array
366370
367371 // autoloader->getNamespace($prefix) returns an array of paths for that namespace
368372 foreach ($ this ->autoloader ->getNamespace ($ prefix ) as $ namespacePath ) {
369- $ fullPath = rtrim ($ namespacePath , '/ ' ) . '/ ' . $ path ;
370- $ fullPath = realpath ($ fullPath ) !== false ? realpath ($ fullPath ) : $ fullPath ;
373+ $ fullPath = rtrim ($ namespacePath , '/ ' ) . '/ ' . $ path ;
374+ $ resolvedPath = realpath ($ fullPath );
375+ $ fullPath = $ resolvedPath !== false ? $ resolvedPath : $ fullPath ;
371376
372377 if (! is_dir ($ fullPath )) {
373378 continue ;
@@ -393,8 +398,9 @@ public function listNamespaceFiles(string $prefix, string $path): array
393398 */
394399 protected function legacyLocate (string $ file , ?string $ folder = null )
395400 {
396- $ path = APPPATH . ($ folder === null ? $ file : $ folder . '/ ' . $ file );
397- $ path = realpath ($ path ) !== false ? realpath ($ path ) : $ path ;
401+ $ path = APPPATH . ($ folder === null ? $ file : $ folder . '/ ' . $ file );
402+ $ resolvedPath = realpath ($ path );
403+ $ path = $ resolvedPath !== false ? $ resolvedPath : $ path ;
398404
399405 if (is_file ($ path )) {
400406 return $ path ;
0 commit comments