X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fclass-loader%2FDebugUniversalClassLoader.php;fp=vendor%2Fsymfony%2Fclass-loader%2FDebugUniversalClassLoader.php;h=807bcd15e2fb7c2f1f29965cc7d0aa0573a7512e;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/symfony/class-loader/DebugUniversalClassLoader.php b/vendor/symfony/class-loader/DebugUniversalClassLoader.php new file mode 100644 index 000000000..807bcd15e --- /dev/null +++ b/vendor/symfony/class-loader/DebugUniversalClassLoader.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\ClassLoader; + +@trigger_error('The '.__NAMESPACE__.'\DebugUniversalClassLoader class is deprecated since version 2.4 and will be removed in 3.0. Use the Symfony\Component\Debug\DebugClassLoader class instead.', E_USER_DEPRECATED); + +/** + * Checks that the class is actually declared in the included file. + * + * @author Fabien Potencier + * + * @deprecated since version 2.4, to be removed in 3.0. + * Use the {@link \Symfony\Component\Debug\DebugClassLoader} class instead. + */ +class DebugUniversalClassLoader extends UniversalClassLoader +{ + /** + * Replaces all regular UniversalClassLoader instances by a DebugUniversalClassLoader ones. + */ + public static function enable() + { + if (!is_array($functions = spl_autoload_functions())) { + return; + } + + foreach ($functions as $function) { + spl_autoload_unregister($function); + } + + foreach ($functions as $function) { + if (is_array($function) && $function[0] instanceof UniversalClassLoader) { + $loader = new static(); + $loader->registerNamespaceFallbacks($function[0]->getNamespaceFallbacks()); + $loader->registerPrefixFallbacks($function[0]->getPrefixFallbacks()); + $loader->registerNamespaces($function[0]->getNamespaces()); + $loader->registerPrefixes($function[0]->getPrefixes()); + $loader->useIncludePath($function[0]->getUseIncludePath()); + + $function[0] = $loader; + } + + spl_autoload_register($function); + } + } + + /** + * {@inheritdoc} + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + require $file; + + if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) { + throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file)); + } + } + } +}