summaryrefslogtreecommitdiff
path: root/vendor/composer/ClassLoader.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-11-15 18:33:35 +0300
committerAndrew Dolgov <[email protected]>2021-11-15 18:33:35 +0300
commit4c37fa4b41b0cab50a4fc192e9120042dbe36872 (patch)
treed7ca7cbd65de0cea9806870c8fb646ed15d978ae /vendor/composer/ClassLoader.php
parent109b702ed0cd31a0dc8466b8127882d263705d8d (diff)
update phpstan to 1.1.2; update php-qrcode to 3.4.1
Diffstat (limited to 'vendor/composer/ClassLoader.php')
-rw-r--r--vendor/composer/ClassLoader.php157
1 files changed, 15 insertions, 142 deletions
diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php
index 0cd6055d1..fce8549f0 100644
--- a/vendor/composer/ClassLoader.php
+++ b/vendor/composer/ClassLoader.php
@@ -37,130 +37,57 @@ namespace Composer\Autoload;
*
* @author Fabien Potencier <[email protected]>
* @author Jordi Boggiano <[email protected]>
- * @see https://www.php-fig.org/psr/psr-0/
- * @see https://www.php-fig.org/psr/psr-4/
+ * @see http://www.php-fig.org/psr/psr-0/
+ * @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
- /** @var ?string */
- private $vendorDir;
-
// PSR-4
- /**
- * @var array[]
- * @psalm-var array<string, array<string, int>>
- */
private $prefixLengthsPsr4 = array();
- /**
- * @var array[]
- * @psalm-var array<string, array<int, string>>
- */
private $prefixDirsPsr4 = array();
- /**
- * @var array[]
- * @psalm-var array<string, string>
- */
private $fallbackDirsPsr4 = array();
// PSR-0
- /**
- * @var array[]
- * @psalm-var array<string, array<string, string[]>>
- */
private $prefixesPsr0 = array();
- /**
- * @var array[]
- * @psalm-var array<string, string>
- */
private $fallbackDirsPsr0 = array();
- /** @var bool */
private $useIncludePath = false;
-
- /**
- * @var string[]
- * @psalm-var array<string, string>
- */
private $classMap = array();
-
- /** @var bool */
private $classMapAuthoritative = false;
-
- /**
- * @var bool[]
- * @psalm-var array<string, bool>
- */
private $missingClasses = array();
-
- /** @var ?string */
private $apcuPrefix;
- /**
- * @var self[]
- */
- private static $registeredLoaders = array();
-
- /**
- * @param ?string $vendorDir
- */
- public function __construct($vendorDir = null)
- {
- $this->vendorDir = $vendorDir;
- }
-
- /**
- * @return string[]
- */
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
- return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
- /**
- * @return array[]
- * @psalm-return array<string, array<int, string>>
- */
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
- /**
- * @return array[]
- * @psalm-return array<string, string>
- */
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
- /**
- * @return array[]
- * @psalm-return array<string, string>
- */
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
- /**
- * @return string[] Array of classname => path
- * @psalm-var array<string, string>
- */
public function getClassMap()
{
return $this->classMap;
}
/**
- * @param string[] $classMap Class to filename map
- * @psalm-param array<string, string> $classMap
- *
- * @return void
+ * @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
@@ -175,11 +102,9 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
- * @param string $prefix The prefix
- * @param string[]|string $paths The PSR-0 root directories
- * @param bool $prepend Whether to prepend the directories
- *
- * @return void
+ * @param string $prefix The prefix
+ * @param array|string $paths The PSR-0 root directories
+ * @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
@@ -222,13 +147,11 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
- * @param string $prefix The prefix/namespace, with trailing '\\'
- * @param string[]|string $paths The PSR-4 base directories
- * @param bool $prepend Whether to prepend the directories
+ * @param string $prefix The prefix/namespace, with trailing '\\'
+ * @param array|string $paths The PSR-4 base directories
+ * @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
- *
- * @return void
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
@@ -272,10 +195,8 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
- * @param string $prefix The prefix
- * @param string[]|string $paths The PSR-0 base directories
- *
- * @return void
+ * @param string $prefix The prefix
+ * @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
@@ -290,12 +211,10 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
- * @param string $prefix The prefix/namespace, with trailing '\\'
- * @param string[]|string $paths The PSR-4 base directories
+ * @param string $prefix The prefix/namespace, with trailing '\\'
+ * @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
- *
- * @return void
*/
public function setPsr4($prefix, $paths)
{
@@ -315,8 +234,6 @@ class ClassLoader
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
- *
- * @return void
*/
public function setUseIncludePath($useIncludePath)
{
@@ -339,8 +256,6 @@ class ClassLoader
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
- *
- * @return void
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
@@ -361,8 +276,6 @@ class ClassLoader
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
- *
- * @return void
*/
public function setApcuPrefix($apcuPrefix)
{
@@ -383,44 +296,25 @@ class ClassLoader
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
- *
- * @return void
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
-
- if (null === $this->vendorDir) {
- return;
- }
-
- if ($prepend) {
- self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
- } else {
- unset(self::$registeredLoaders[$this->vendorDir]);
- self::$registeredLoaders[$this->vendorDir] = $this;
- }
}
/**
* Unregisters this instance as an autoloader.
- *
- * @return void
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
-
- if (null !== $this->vendorDir) {
- unset(self::$registeredLoaders[$this->vendorDir]);
- }
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
- * @return true|null True if loaded, null otherwise
+ * @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
@@ -429,8 +323,6 @@ class ClassLoader
return true;
}
-
- return null;
}
/**
@@ -475,21 +367,6 @@ class ClassLoader
return $file;
}
- /**
- * Returns the currently registered loaders indexed by their corresponding vendor directories.
- *
- * @return self[]
- */
- public static function getRegisteredLoaders()
- {
- return self::$registeredLoaders;
- }
-
- /**
- * @param string $class
- * @param string $ext
- * @return string|false
- */
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
@@ -561,10 +438,6 @@ class ClassLoader
* Scope isolated include.
*
* Prevents access to $this/self from included files.
- *
- * @param string $file
- * @return void
- * @private
*/
function includeFile($file)
{