composer update
This commit is contained in:
35
vendor/symfony/debug/DebugClassLoader.php
vendored
35
vendor/symfony/debug/DebugClassLoader.php
vendored
@@ -13,6 +13,8 @@ namespace Symfony\Component\Debug;
|
||||
|
||||
use PHPUnit\Framework\MockObject\Matcher\StatelessInvocation;
|
||||
|
||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', DebugClassLoader::class, \Symfony\Component\ErrorHandler\DebugClassLoader::class), E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* Autoloader checking if the class is really defined in the file found.
|
||||
*
|
||||
@@ -24,6 +26,8 @@ use PHPUnit\Framework\MockObject\Matcher\StatelessInvocation;
|
||||
* @author Christophe Coevoet <stof@notk.org>
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
* @author Guilhem Niot <guilhem.niot@gmail.com>
|
||||
*
|
||||
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\DebugClassLoader instead.
|
||||
*/
|
||||
class DebugClassLoader
|
||||
{
|
||||
@@ -153,11 +157,11 @@ class DebugClassLoader
|
||||
if (!$file = $this->classLoader[0]->findFile($class) ?: false) {
|
||||
// no-op
|
||||
} elseif (\function_exists('opcache_is_script_cached') && @opcache_is_script_cached($file)) {
|
||||
require $file;
|
||||
include $file;
|
||||
|
||||
return;
|
||||
} else {
|
||||
require $file;
|
||||
} elseif (false === include $file) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
($this->classLoader)($class);
|
||||
@@ -170,7 +174,7 @@ class DebugClassLoader
|
||||
$this->checkClass($class, $file);
|
||||
}
|
||||
|
||||
private function checkClass($class, $file = null)
|
||||
private function checkClass(string $class, string $file = null)
|
||||
{
|
||||
$exists = null === $file || class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false);
|
||||
|
||||
@@ -258,7 +262,7 @@ class DebugClassLoader
|
||||
}
|
||||
|
||||
$parent = get_parent_class($class);
|
||||
$parentAndOwnInterfaces = $this->getOwnInterfaces($class, $parent);
|
||||
$parentAndOwnInterfaces = $this->getOwnInterfaces($class, $parent ?: null);
|
||||
if ($parent) {
|
||||
$parentAndOwnInterfaces[$parent] = $parent;
|
||||
|
||||
@@ -395,6 +399,12 @@ class DebugClassLoader
|
||||
return $deprecations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file
|
||||
* @param string $class
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function checkCase(\ReflectionClass $refl, $file, $class)
|
||||
{
|
||||
$real = explode('\\', $class.strrchr($file, '.'));
|
||||
@@ -411,7 +421,7 @@ class DebugClassLoader
|
||||
array_splice($tail, 0, $i + 1);
|
||||
|
||||
if (!$tail) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail);
|
||||
@@ -427,12 +437,14 @@ class DebugClassLoader
|
||||
) {
|
||||
return [substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* `realpath` on MacOSX doesn't normalize the case of characters.
|
||||
*/
|
||||
private function darwinRealpath($real)
|
||||
private function darwinRealpath(string $real): string
|
||||
{
|
||||
$i = 1 + strrpos($real, '/');
|
||||
$file = substr($real, $i);
|
||||
@@ -474,7 +486,7 @@ class DebugClassLoader
|
||||
}
|
||||
|
||||
if (isset($dirFiles[$file])) {
|
||||
return $real .= $dirFiles[$file];
|
||||
return $real.$dirFiles[$file];
|
||||
}
|
||||
|
||||
$kFile = strtolower($file);
|
||||
@@ -493,18 +505,15 @@ class DebugClassLoader
|
||||
self::$darwinCache[$kDir][1] = $dirFiles;
|
||||
}
|
||||
|
||||
return $real .= $dirFiles[$kFile];
|
||||
return $real.$dirFiles[$kFile];
|
||||
}
|
||||
|
||||
/**
|
||||
* `class_implements` includes interfaces from the parents so we have to manually exclude them.
|
||||
*
|
||||
* @param string $class
|
||||
* @param string|false $parent
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
private function getOwnInterfaces($class, $parent)
|
||||
private function getOwnInterfaces(string $class, ?string $parent): array
|
||||
{
|
||||
$ownInterfaces = class_implements($class, false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user