Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DebugClassLoader.php

function DebugClassLoader::loadClass

Loads the given class or interface.

Throws

\RuntimeException

File

vendor/symfony/error-handler/DebugClassLoader.php, line 287

Class

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

Namespace

Symfony\Component\ErrorHandler

Code

public function loadClass(string $class) : void {
    $e = error_reporting(error_reporting() | \E_PARSE | \E_ERROR | \E_CORE_ERROR | \E_COMPILE_ERROR);
    try {
        if ($this->isFinder && !isset($this->loaded[$class])) {
            $this->loaded[$class] = true;
            if (!($file = $this->classLoader[0]
                ->findFile($class) ?: '')) {
                // no-op
            }
            elseif (\function_exists('opcache_is_script_cached') && @opcache_is_script_cached($file)) {
                include $file;
                return;
            }
            elseif (false === (include $file)) {
                return;
            }
        }
        else {
            ($this->classLoader)($class);
            $file = '';
        }
    } finally {
        error_reporting($e);
    }
    $this->checkClass($class, $file);
}
RSS feed
Powered by Drupal