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

Breadcrumb

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

function PhpDumper::getAutoloadFile

1 call to PhpDumper::getAutoloadFile()
PhpDumper::dump in vendor/symfony/dependency-injection/Dumper/PhpDumper.php
Dumps the service container as a PHP class.

File

vendor/symfony/dependency-injection/Dumper/PhpDumper.php, line 2274

Class

PhpDumper
PhpDumper dumps a service container as a PHP class.

Namespace

Symfony\Component\DependencyInjection\Dumper

Code

private function getAutoloadFile() : ?string {
    $file = null;
    foreach (spl_autoload_functions() as $autoloader) {
        if (!\is_array($autoloader)) {
            continue;
        }
        if ($autoloader[0] instanceof DebugClassLoader) {
            $autoloader = $autoloader[0]->getClassLoader();
        }
        if (!\is_array($autoloader) || !$autoloader[0] instanceof ClassLoader || !$autoloader[0]->findFile(__CLASS__)) {
            continue;
        }
        foreach (get_declared_classes() as $class) {
            if (str_starts_with($class, 'ComposerAutoloaderInit') && $class::getLoader() === $autoloader[0]) {
                $file = \dirname((new \ReflectionClass($class))->getFileName(), 2) . '/autoload.php';
                if (null !== $this->targetDirRegex && preg_match($this->targetDirRegex . 'A', $file)) {
                    return $file;
                }
            }
        }
    }
    return $file;
}
RSS feed
Powered by Drupal