You are here

public static function DebugClassLoader::enable in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/debug/DebugClassLoader.php \Symfony\Component\Debug\DebugClassLoader::enable()
  2. 8 vendor/symfony/class-loader/DebugClassLoader.php \Symfony\Component\ClassLoader\DebugClassLoader::enable()
Same name and namespace in other branches
  1. 8.0 vendor/symfony/class-loader/DebugClassLoader.php \Symfony\Component\ClassLoader\DebugClassLoader::enable()

Replaces all autoloaders implementing a findFile method by a DebugClassLoader wrapper.

File

vendor/symfony/class-loader/DebugClassLoader.php, line 56

Class

DebugClassLoader
Autoloader checking if the class is really defined in the file found.

Namespace

Symfony\Component\ClassLoader

Code

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 self && method_exists($function[0], 'findFile')) {
      $function = array(
        new static($function[0]),
        'loadClass',
      );
    }
    spl_autoload_register($function);
  }
}