1
0
Fork 0

Merge pull request #9658 from Ayesh/improve/class-autoloader-conditional-path

Minor improvement to ClassLoader::register no-op block
pull/9662/head
Jordi Boggiano 2021-02-01 14:14:34 +01:00 committed by GitHub
commit 1e72b23fd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -311,8 +311,10 @@ class ClassLoader
spl_autoload_register(array($this, 'loadClass'), true, $prepend); spl_autoload_register(array($this, 'loadClass'), true, $prepend);
if (null === $this->vendorDir) { if (null === $this->vendorDir) {
//no-op return;
} elseif ($prepend) { }
if ($prepend) {
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
} else { } else {
unset(self::$registeredLoaders[$this->vendorDir]); unset(self::$registeredLoaders[$this->vendorDir]);