class BackwardsCompatibilityClassLoader

Hierarchy

Expanded class hierarchy of BackwardsCompatibilityClassLoader

1 file declares its use of BackwardsCompatibilityClassLoader
DrupalKernel.php in core/lib/Drupal/Core/DrupalKernel.php

File

core/lib/Drupal/Core/ClassLoader/BackwardsCompatibilityClassLoader.php, line 7

Namespace

Drupal\Core\ClassLoader
View source
final class BackwardsCompatibilityClassLoader {
    public function __construct(array $movedClasses) {
    }
    
    /**
     * Aliases a moved class to another class, instead of actually autoloading it.
     *
     * @param string $class
     *   The classname to load.
     */
    public function loadClass(string $class) : void {
        if (isset($this->movedClasses[$class])) {
            $moved = $this->movedClasses[$class];
            if (isset($moved['deprecation_version']) && isset($moved['removed_version']) && isset($moved['change_record'])) {
                // @phpcs:ignore
                @trigger_error(sprintf('Class %s is deprecated in %s and is removed from %s, use %s instead. See %s', $class, $moved['deprecation_version'], $moved['removed_version'], $moved['class'], $moved['change_record']), E_USER_DEPRECATED);
            }
            class_alias($moved['class'], $class, TRUE);
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary
BackwardsCompatibilityClassLoader::loadClass public function Aliases a moved class to another class, instead of actually autoloading it.
BackwardsCompatibilityClassLoader::__construct public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.