some fix
This commit is contained in:
		
							
								
								
									
										96
									
								
								vendor/composer/ClassLoader.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										96
									
								
								vendor/composer/ClassLoader.php
									
									
									
									
										vendored
									
									
								
							| @@ -45,34 +45,35 @@ class ClassLoader | ||||
|     /** @var \Closure(string):void */ | ||||
|     private static $includeFile; | ||||
|  | ||||
|     /** @var string|null */ | ||||
|     /** @var ?string */ | ||||
|     private $vendorDir; | ||||
|  | ||||
|     // PSR-4 | ||||
|     /** | ||||
|      * @var array<string, array<string, int>> | ||||
|      * @var array[] | ||||
|      * @psalm-var array<string, array<string, int>> | ||||
|      */ | ||||
|     private $prefixLengthsPsr4 = array(); | ||||
|     /** | ||||
|      * @var array<string, list<string>> | ||||
|      * @var array[] | ||||
|      * @psalm-var array<string, array<int, string>> | ||||
|      */ | ||||
|     private $prefixDirsPsr4 = array(); | ||||
|     /** | ||||
|      * @var list<string> | ||||
|      * @var array[] | ||||
|      * @psalm-var array<string, string> | ||||
|      */ | ||||
|     private $fallbackDirsPsr4 = array(); | ||||
|  | ||||
|     // PSR-0 | ||||
|     /** | ||||
|      * List of PSR-0 prefixes | ||||
|      * | ||||
|      * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) | ||||
|      * | ||||
|      * @var array<string, array<string, list<string>>> | ||||
|      * @var array[] | ||||
|      * @psalm-var array<string, array<string, string[]>> | ||||
|      */ | ||||
|     private $prefixesPsr0 = array(); | ||||
|     /** | ||||
|      * @var list<string> | ||||
|      * @var array[] | ||||
|      * @psalm-var array<string, string> | ||||
|      */ | ||||
|     private $fallbackDirsPsr0 = array(); | ||||
|  | ||||
| @@ -80,7 +81,8 @@ class ClassLoader | ||||
|     private $useIncludePath = false; | ||||
|  | ||||
|     /** | ||||
|      * @var array<string, string> | ||||
|      * @var string[] | ||||
|      * @psalm-var array<string, string> | ||||
|      */ | ||||
|     private $classMap = array(); | ||||
|  | ||||
| @@ -88,20 +90,21 @@ class ClassLoader | ||||
|     private $classMapAuthoritative = false; | ||||
|  | ||||
|     /** | ||||
|      * @var array<string, bool> | ||||
|      * @var bool[] | ||||
|      * @psalm-var array<string, bool> | ||||
|      */ | ||||
|     private $missingClasses = array(); | ||||
|  | ||||
|     /** @var string|null */ | ||||
|     /** @var ?string */ | ||||
|     private $apcuPrefix; | ||||
|  | ||||
|     /** | ||||
|      * @var array<string, self> | ||||
|      * @var self[] | ||||
|      */ | ||||
|     private static $registeredLoaders = array(); | ||||
|  | ||||
|     /** | ||||
|      * @param string|null $vendorDir | ||||
|      * @param ?string $vendorDir | ||||
|      */ | ||||
|     public function __construct($vendorDir = null) | ||||
|     { | ||||
| @@ -110,7 +113,7 @@ class ClassLoader | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array<string, list<string>> | ||||
|      * @return string[] | ||||
|      */ | ||||
|     public function getPrefixes() | ||||
|     { | ||||
| @@ -122,7 +125,8 @@ class ClassLoader | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array<string, list<string>> | ||||
|      * @return array[] | ||||
|      * @psalm-return array<string, array<int, string>> | ||||
|      */ | ||||
|     public function getPrefixesPsr4() | ||||
|     { | ||||
| @@ -130,7 +134,8 @@ class ClassLoader | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return list<string> | ||||
|      * @return array[] | ||||
|      * @psalm-return array<string, string> | ||||
|      */ | ||||
|     public function getFallbackDirs() | ||||
|     { | ||||
| @@ -138,7 +143,8 @@ class ClassLoader | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return list<string> | ||||
|      * @return array[] | ||||
|      * @psalm-return array<string, string> | ||||
|      */ | ||||
|     public function getFallbackDirsPsr4() | ||||
|     { | ||||
| @@ -146,7 +152,8 @@ class ClassLoader | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array<string, string> Array of classname => path | ||||
|      * @return string[] Array of classname => path | ||||
|      * @psalm-return array<string, string> | ||||
|      */ | ||||
|     public function getClassMap() | ||||
|     { | ||||
| @@ -154,7 +161,8 @@ class ClassLoader | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param array<string, string> $classMap Class to filename map | ||||
|      * @param string[] $classMap Class to filename map | ||||
|      * @psalm-param array<string, string> $classMap | ||||
|      * | ||||
|      * @return void | ||||
|      */ | ||||
| @@ -171,25 +179,24 @@ 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 list<string>|string $paths   The PSR-0 root directories | ||||
|      * @param bool                $prepend Whether to prepend the directories | ||||
|      * @param string          $prefix  The prefix | ||||
|      * @param string[]|string $paths   The PSR-0 root directories | ||||
|      * @param bool            $prepend Whether to prepend the directories | ||||
|      * | ||||
|      * @return void | ||||
|      */ | ||||
|     public function add($prefix, $paths, $prepend = false) | ||||
|     { | ||||
|         $paths = (array) $paths; | ||||
|         if (!$prefix) { | ||||
|             if ($prepend) { | ||||
|                 $this->fallbackDirsPsr0 = array_merge( | ||||
|                     $paths, | ||||
|                     (array) $paths, | ||||
|                     $this->fallbackDirsPsr0 | ||||
|                 ); | ||||
|             } else { | ||||
|                 $this->fallbackDirsPsr0 = array_merge( | ||||
|                     $this->fallbackDirsPsr0, | ||||
|                     $paths | ||||
|                     (array) $paths | ||||
|                 ); | ||||
|             } | ||||
|  | ||||
| @@ -198,19 +205,19 @@ class ClassLoader | ||||
|  | ||||
|         $first = $prefix[0]; | ||||
|         if (!isset($this->prefixesPsr0[$first][$prefix])) { | ||||
|             $this->prefixesPsr0[$first][$prefix] = $paths; | ||||
|             $this->prefixesPsr0[$first][$prefix] = (array) $paths; | ||||
|  | ||||
|             return; | ||||
|         } | ||||
|         if ($prepend) { | ||||
|             $this->prefixesPsr0[$first][$prefix] = array_merge( | ||||
|                 $paths, | ||||
|                 (array) $paths, | ||||
|                 $this->prefixesPsr0[$first][$prefix] | ||||
|             ); | ||||
|         } else { | ||||
|             $this->prefixesPsr0[$first][$prefix] = array_merge( | ||||
|                 $this->prefixesPsr0[$first][$prefix], | ||||
|                 $paths | ||||
|                 (array) $paths | ||||
|             ); | ||||
|         } | ||||
|     } | ||||
| @@ -219,9 +226,9 @@ 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 list<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 string[]|string $paths   The PSR-4 base directories | ||||
|      * @param bool            $prepend Whether to prepend the directories | ||||
|      * | ||||
|      * @throws \InvalidArgumentException | ||||
|      * | ||||
| @@ -229,18 +236,17 @@ class ClassLoader | ||||
|      */ | ||||
|     public function addPsr4($prefix, $paths, $prepend = false) | ||||
|     { | ||||
|         $paths = (array) $paths; | ||||
|         if (!$prefix) { | ||||
|             // Register directories for the root namespace. | ||||
|             if ($prepend) { | ||||
|                 $this->fallbackDirsPsr4 = array_merge( | ||||
|                     $paths, | ||||
|                     (array) $paths, | ||||
|                     $this->fallbackDirsPsr4 | ||||
|                 ); | ||||
|             } else { | ||||
|                 $this->fallbackDirsPsr4 = array_merge( | ||||
|                     $this->fallbackDirsPsr4, | ||||
|                     $paths | ||||
|                     (array) $paths | ||||
|                 ); | ||||
|             } | ||||
|         } elseif (!isset($this->prefixDirsPsr4[$prefix])) { | ||||
| @@ -250,18 +256,18 @@ class ClassLoader | ||||
|                 throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); | ||||
|             } | ||||
|             $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; | ||||
|             $this->prefixDirsPsr4[$prefix] = $paths; | ||||
|             $this->prefixDirsPsr4[$prefix] = (array) $paths; | ||||
|         } elseif ($prepend) { | ||||
|             // Prepend directories for an already registered namespace. | ||||
|             $this->prefixDirsPsr4[$prefix] = array_merge( | ||||
|                 $paths, | ||||
|                 (array) $paths, | ||||
|                 $this->prefixDirsPsr4[$prefix] | ||||
|             ); | ||||
|         } else { | ||||
|             // Append directories for an already registered namespace. | ||||
|             $this->prefixDirsPsr4[$prefix] = array_merge( | ||||
|                 $this->prefixDirsPsr4[$prefix], | ||||
|                 $paths | ||||
|                 (array) $paths | ||||
|             ); | ||||
|         } | ||||
|     } | ||||
| @@ -270,8 +276,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 list<string>|string $paths  The PSR-0 base directories | ||||
|      * @param string          $prefix The prefix | ||||
|      * @param string[]|string $paths  The PSR-0 base directories | ||||
|      * | ||||
|      * @return void | ||||
|      */ | ||||
| @@ -288,8 +294,8 @@ 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 list<string>|string $paths  The PSR-4 base directories | ||||
|      * @param string          $prefix The prefix/namespace, with trailing '\\' | ||||
|      * @param string[]|string $paths  The PSR-4 base directories | ||||
|      * | ||||
|      * @throws \InvalidArgumentException | ||||
|      * | ||||
| @@ -475,9 +481,9 @@ class ClassLoader | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the currently registered loaders keyed by their corresponding vendor directories. | ||||
|      * Returns the currently registered loaders indexed by their corresponding vendor directories. | ||||
|      * | ||||
|      * @return array<string, self> | ||||
|      * @return self[] | ||||
|      */ | ||||
|     public static function getRegisteredLoaders() | ||||
|     { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user