Skip to content

Commit

Permalink
fix: Cannot declare class CodeIgniter\Config\Services, because the na…
Browse files Browse the repository at this point in the history
…me is already in use

See codeigniter4#8745 (comment)
  • Loading branch information
kenjis committed Apr 13, 2024
1 parent 666c8fc commit 90748d2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions system/Autoloader/FileLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,23 @@ protected function getNamespaces()
}

/**
* Find the qualified name of a file according to
* the namespace of the first matched namespace path.
* Find the qualified name of a file according to the namespace of the first
* matched namespace path.
*
* This does not find files in `CodeIgniter` namespace.
*
* @return false|string The qualified name or false if the path is not found
*/
public function findQualifiedNameFromPath(string $path)
{
$path = realpath($path) ?: $path;

// Does not search `CodeIgniter` namespace to prevent from loading twice.
$systemPath = $this->autoloader->getNamespace('CodeIgniter')[0];
if (str_starts_with($path, $systemPath)) {
return false;
}

if (! is_file($path)) {
return false;
}
Expand Down

0 comments on commit 90748d2

Please sign in to comment.