public static function DebugClassLoader::enable

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

2 calls to DebugClassLoader::enable()
Debug::enable in drupal/core/vendor/symfony/debug/Symfony/Component/Debug/Debug.php
Enables the debug tools.
DebugClassLoaderTest::testIdempotence in drupal/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/DebugClassLoaderTest.php

File

drupal/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php, line 45

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);
  }
}