Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line diff
--- a/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php Tue Jul 10 15:07:59 2018 +0100 +++ b/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php Thu Feb 28 13:21:36 2019 +0000 @@ -11,11 +11,11 @@ namespace Symfony\Component\Debug\FatalErrorHandler; +use Composer\Autoload\ClassLoader as ComposerClassLoader; +use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader; +use Symfony\Component\Debug\DebugClassLoader; use Symfony\Component\Debug\Exception\ClassNotFoundException; use Symfony\Component\Debug\Exception\FatalErrorException; -use Symfony\Component\Debug\DebugClassLoader; -use Composer\Autoload\ClassLoader as ComposerClassLoader; -use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader; /** * ErrorHandler for classes that do not exist. @@ -29,9 +29,9 @@ */ public function handleError(array $error, FatalErrorException $exception) { - $messageLen = strlen($error['message']); + $messageLen = \strlen($error['message']); $notFoundSuffix = '\' not found'; - $notFoundSuffixLen = strlen($notFoundSuffix); + $notFoundSuffixLen = \strlen($notFoundSuffix); if ($notFoundSuffixLen > $messageLen) { return; } @@ -40,9 +40,9 @@ return; } - foreach (array('class', 'interface', 'trait') as $typeName) { + foreach (['class', 'interface', 'trait'] as $typeName) { $prefix = ucfirst($typeName).' \''; - $prefixLen = strlen($prefix); + $prefixLen = \strlen($prefix); if (0 !== strpos($error['message'], $prefix)) { continue; } @@ -85,22 +85,22 @@ */ private function getClassCandidates($class) { - if (!is_array($functions = spl_autoload_functions())) { - return array(); + if (!\is_array($functions = spl_autoload_functions())) { + return []; } // find Symfony and Composer autoloaders - $classes = array(); + $classes = []; foreach ($functions as $function) { - if (!is_array($function)) { + if (!\is_array($function)) { continue; } // get class loaders wrapped by DebugClassLoader if ($function[0] instanceof DebugClassLoader) { $function = $function[0]->getClassLoader(); - if (!is_array($function)) { + if (!\is_array($function)) { continue; } } @@ -133,11 +133,11 @@ */ private function findClassInPath($path, $class, $prefix) { - if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) { - return array(); + if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) { + return []; } - $classes = array(); + $classes = []; $filename = $class.'.php'; foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) { @@ -157,9 +157,9 @@ */ private function convertFileToClass($path, $file, $prefix) { - $candidates = array( + $candidates = [ // namespaced class - $namespacedClass = str_replace(array($path.DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file), + $namespacedClass = str_replace([$path.\DIRECTORY_SEPARATOR, '.php', '/'], ['', '', '\\'], $file), // namespaced class (with target dir) $prefix.$namespacedClass, // namespaced class (with target dir and separator) @@ -170,7 +170,7 @@ str_replace('\\', '_', $prefix.$namespacedClass), // PEAR class (with target dir and separator) str_replace('\\', '_', $prefix.'\\'.$namespacedClass), - ); + ]; if ($prefix) { $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });