function DebugClassLoader::checkCase
1 call to DebugClassLoader::checkCase()
- DebugClassLoader::checkClass in vendor/
symfony/ error-handler/ DebugClassLoader.php
File
-
vendor/
symfony/ error-handler/ DebugClassLoader.php, line 668
Class
- DebugClassLoader
- Autoloader checking if the class is really defined in the file found.
Namespace
Symfony\Component\ErrorHandlerCode
public function checkCase(\ReflectionClass $refl, string $file, string $class) : ?array {
$real = explode('\\', $class . strrchr($file, '.'));
$tail = explode(\DIRECTORY_SEPARATOR, str_replace('/', \DIRECTORY_SEPARATOR, $file));
$i = \count($tail) - 1;
$j = \count($real) - 1;
while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
--$i;
--$j;
}
array_splice($tail, 0, $i + 1);
if (!$tail) {
return null;
}
$tail = \DIRECTORY_SEPARATOR . implode(\DIRECTORY_SEPARATOR, $tail);
$tailLen = \strlen($tail);
$real = $refl->getFileName();
if (2 === self::$caseCheck) {
$real = $this->darwinRealpath($real);
}
if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true) && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)) {
return [
substr($tail, -$tailLen + 1),
substr($real, -$tailLen + 1),
substr($real, 0, -$tailLen + 1),
];
}
return null;
}