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

Breadcrumb

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

function DebugClassLoader::__construct

File

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

Class

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

Namespace

Symfony\Component\ErrorHandler

Code

public function __construct(callable $classLoader) {
    $this->classLoader = $classLoader;
    $this->isFinder = \is_array($classLoader) && method_exists($classLoader[0], 'findFile');
    parse_str($_ENV['SYMFONY_PATCH_TYPE_DECLARATIONS'] ?? $_SERVER['SYMFONY_PATCH_TYPE_DECLARATIONS'] ?? getenv('SYMFONY_PATCH_TYPE_DECLARATIONS') ?: '', $this->patchTypes);
    $this->patchTypes += [
        'force' => null,
        'php' => \PHP_MAJOR_VERSION . '.' . \PHP_MINOR_VERSION,
        'deprecations' => true,
    ];
    if ('phpdoc' === $this->patchTypes['force']) {
        $this->patchTypes['force'] = 'docblock';
    }
    if (!isset(self::$caseCheck)) {
        $file = is_file(__FILE__) ? __FILE__ : rtrim(realpath('.'), \DIRECTORY_SEPARATOR);
        $i = strrpos($file, \DIRECTORY_SEPARATOR);
        $dir = substr($file, 0, 1 + $i);
        $file = substr($file, 1 + $i);
        $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
        $test = realpath($dir . $test);
        if (false === $test || false === $i) {
            // filesystem is case-sensitive
            self::$caseCheck = 0;
        }
        elseif (str_ends_with($test, $file)) {
            // filesystem is case-insensitive and realpath() normalizes the case of characters
            self::$caseCheck = 1;
        }
        elseif ('Darwin' === \PHP_OS_FAMILY) {
            // on MacOSX, HFS+ is case-insensitive but realpath() doesn't normalize the case of characters
            self::$caseCheck = 2;
        }
        else {
            // filesystem case checks failed, fallback to disabling them
            self::$caseCheck = 0;
        }
    }
}
RSS feed
Powered by Drupal