PluginProbe
Hostinger Tools / 3.0.4
Hostinger Tools v3.0.4
3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.4 All 108 releases
← All changes | vendor/composer/ClassLoader.php +45 -51 1.8.13.0.4 View file →
@@ -44,37 +44,36 @@
44 44 {
45 45 /** @var \Closure(string):void */
46 46 private static $includeFile;
47 47
48 - /** @var ?string */
48 + /** @var string|null */
49 49 private $vendorDir;
50 50
51 51 // PSR-4
52 52 /**
53 - * @var array[]
54 - * @psalm-var array<string, array<string, int>>
53 + * @var array<string, array<string, int>>
55 54 */
56 55 private $prefixLengthsPsr4 = array();
57 56 /**
58 - * @var array[]
59 - * @psalm-var array<string, array<int, string>>
57 + * @var array<string, list<string>>
60 58 */
61 59 private $prefixDirsPsr4 = array();
62 60 /**
63 - * @var array[]
64 - * @psalm-var array<string, string>
61 + * @var list<string>
65 62 */
66 63 private $fallbackDirsPsr4 = array();
67 64
68 65 // PSR-0
69 66 /**
70 - * @var array[]
71 - * @psalm-var array<string, array<string, string[]>>
67 + * List of PSR-0 prefixes
68 + *
69 + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
70 + *
71 + * @var array<string, array<string, list<string>>>
72 72 */
73 73 private $prefixesPsr0 = array();
74 74 /**
75 - * @var array[]
76 - * @psalm-var array<string, string>
75 + * @var list<string>
77 76 */
78 77 private $fallbackDirsPsr0 = array();
79 78
80 79 /** @var bool */
@@ -80,10 +79,9 @@
80 79 /** @var bool */
81 80 private $useIncludePath = false;
82 81
83 82 /**
84 - * @var string[]
85 - * @psalm-var array<string, string>
83 + * @var array<string, string>
86 84 */
87 85 private $classMap = array();
88 86
89 87 /** @var bool */
@@ -89,23 +87,22 @@
89 87 /** @var bool */
90 88 private $classMapAuthoritative = false;
91 89
92 90 /**
93 - * @var bool[]
94 - * @psalm-var array<string, bool>
91 + * @var array<string, bool>
95 92 */
96 93 private $missingClasses = array();
97 94
98 - /** @var ?string */
95 + /** @var string|null */
99 96 private $apcuPrefix;
100 97
101 98 /**
102 - * @var self[]
99 + * @var array<string, self>
103 100 */
104 101 private static $registeredLoaders = array();
105 102
106 103 /**
107 - * @param ?string $vendorDir
104 + * @param string|null $vendorDir
108 105 */
109 106 public function __construct($vendorDir = null)
110 107 {
111 108 $this->vendorDir = $vendorDir;
@@ -112,9 +109,9 @@
112 109 self::initializeIncludeClosure();
113 110 }
114 111
115 112 /**
116 - * @return string[]
113 + * @return array<string, list<string>>
117 114 */
118 115 public function getPrefixes()
119 116 {
120 117 if (!empty($this->prefixesPsr0)) {
@@ -124,10 +121,9 @@
124 121 return array();
125 122 }
126 123
127 124 /**
128 - * @return array[]
129 - * @psalm-return array<string, array<int, string>>
125 + * @return array<string, list<string>>
130 126 */
131 127 public function getPrefixesPsr4()
132 128 {
133 129 return $this->prefixDirsPsr4;
@@ -133,10 +129,9 @@
133 129 return $this->prefixDirsPsr4;
134 130 }
135 131
136 132 /**
137 - * @return array[]
138 - * @psalm-return array<string, string>
133 + * @return list<string>
139 134 */
140 135 public function getFallbackDirs()
141 136 {
142 137 return $this->fallbackDirsPsr0;
@@ -142,10 +137,9 @@
142 137 return $this->fallbackDirsPsr0;
143 138 }
144 139
145 140 /**
146 - * @return array[]
147 - * @psalm-return array<string, string>
141 + * @return list<string>
148 142 */
149 143 public function getFallbackDirsPsr4()
150 144 {
151 145 return $this->fallbackDirsPsr4;
@@ -151,10 +145,9 @@
151 145 return $this->fallbackDirsPsr4;
152 146 }
153 147
154 148 /**
155 - * @return string[] Array of classname => path
156 - * @psalm-return array<string, string>
149 + * @return array<string, string> Array of classname => path
157 150 */
158 151 public function getClassMap()
159 152 {
160 153 return $this->classMap;
@@ -160,10 +153,9 @@
160 153 return $this->classMap;
161 154 }
162 155
163 156 /**
164 - * @param string[] $classMap Class to filename map
165 - * @psalm-param array<string, string> $classMap
157 + * @param array<string, string> $classMap Class to filename map
166 158 *
167 159 * @return void
168 160 */
169 161 public function addClassMap(array $classMap)
@@ -178,26 +170,27 @@
178 170 /**
179 171 * Registers a set of PSR-0 directories for a given prefix, either
180 172 * appending or prepending to the ones previously set for this prefix.
181 173 *
182 - * @param string $prefix The prefix
183 - * @param string[]|string $paths The PSR-0 root directories
184 - * @param bool $prepend Whether to prepend the directories
174 + * @param string $prefix The prefix
175 + * @param list<string>|string $paths The PSR-0 root directories
176 + * @param bool $prepend Whether to prepend the directories
185 177 *
186 178 * @return void
187 179 */
188 180 public function add($prefix, $paths, $prepend = false)
189 181 {
182 + $paths = (array) $paths;
190 183 if (!$prefix) {
191 184 if ($prepend) {
192 185 $this->fallbackDirsPsr0 = array_merge(
193 - (array) $paths,
186 + $paths,
194 187 $this->fallbackDirsPsr0
195 188 );
196 189 } else {
197 190 $this->fallbackDirsPsr0 = array_merge(
198 191 $this->fallbackDirsPsr0,
199 - (array) $paths
192 + $paths
200 193 );
201 194 }
202 195
203 196 return;
@@ -204,21 +197,21 @@
204 197 }
205 198
206 199 $first = $prefix[0];
207 200 if (!isset($this->prefixesPsr0[$first][$prefix])) {
208 - $this->prefixesPsr0[$first][$prefix] = (array) $paths;
201 + $this->prefixesPsr0[$first][$prefix] = $paths;
209 202
210 203 return;
211 204 }
212 205 if ($prepend) {
213 206 $this->prefixesPsr0[$first][$prefix] = array_merge(
214 - (array) $paths,
207 + $paths,
215 208 $this->prefixesPsr0[$first][$prefix]
216 209 );
217 210 } else {
218 211 $this->prefixesPsr0[$first][$prefix] = array_merge(
219 212 $this->prefixesPsr0[$first][$prefix],
220 - (array) $paths
213 + $paths
221 214 );
222 215 }
223 216 }
224 217
@@ -225,11 +218,11 @@
225 218 /**
226 219 * Registers a set of PSR-4 directories for a given namespace, either
227 220 * appending or prepending to the ones previously set for this namespace.
228 221 *
229 - * @param string $prefix The prefix/namespace, with trailing '\\'
230 - * @param string[]|string $paths The PSR-4 base directories
231 - * @param bool $prepend Whether to prepend the directories
222 + * @param string $prefix The prefix/namespace, with trailing '\\'
223 + * @param list<string>|string $paths The PSR-4 base directories
224 + * @param bool $prepend Whether to prepend the directories
232 225 *
233 226 * @throws \InvalidArgumentException
234 227 *
235 228 * @return void
@@ -235,19 +228,20 @@
235 228 * @return void
236 229 */
237 230 public function addPsr4($prefix, $paths, $prepend = false)
238 231 {
232 + $paths = (array) $paths;
239 233 if (!$prefix) {
240 234 // Register directories for the root namespace.
241 235 if ($prepend) {
242 236 $this->fallbackDirsPsr4 = array_merge(
243 - (array) $paths,
237 + $paths,
244 238 $this->fallbackDirsPsr4
245 239 );
246 240 } else {
247 241 $this->fallbackDirsPsr4 = array_merge(
248 242 $this->fallbackDirsPsr4,
249 - (array) $paths
243 + $paths
250 244 );
251 245 }
252 246 } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
253 247 // Register directories for a new namespace.
@@ -255,13 +249,13 @@
255 249 if ('\\' !== $prefix[$length - 1]) {
256 250 throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
257 251 }
258 252 $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
259 - $this->prefixDirsPsr4[$prefix] = (array) $paths;
253 + $this->prefixDirsPsr4[$prefix] = $paths;
260 254 } elseif ($prepend) {
261 255 // Prepend directories for an already registered namespace.
262 256 $this->prefixDirsPsr4[$prefix] = array_merge(
263 - (array) $paths,
257 + $paths,
264 258 $this->prefixDirsPsr4[$prefix]
265 259 );
266 260 } else {
267 261 // Append directories for an already registered namespace.
@@ -266,9 +260,9 @@
266 260 } else {
267 261 // Append directories for an already registered namespace.
268 262 $this->prefixDirsPsr4[$prefix] = array_merge(
269 263 $this->prefixDirsPsr4[$prefix],
270 - (array) $paths
264 + $paths
271 265 );
272 266 }
273 267 }
274 268
@@ -275,10 +269,10 @@
275 269 /**
276 270 * Registers a set of PSR-0 directories for a given prefix,
277 271 * replacing any others previously set for this prefix.
278 272 *
279 - * @param string $prefix The prefix
280 - * @param string[]|string $paths The PSR-0 base directories
273 + * @param string $prefix The prefix
274 + * @param list<string>|string $paths The PSR-0 base directories
281 275 *
282 276 * @return void
283 277 */
284 278 public function set($prefix, $paths)
@@ -293,10 +287,10 @@
293 287 /**
294 288 * Registers a set of PSR-4 directories for a given namespace,
295 289 * replacing any others previously set for this namespace.
296 290 *
297 - * @param string $prefix The prefix/namespace, with trailing '\\'
298 - * @param string[]|string $paths The PSR-4 base directories
291 + * @param string $prefix The prefix/namespace, with trailing '\\'
292 + * @param list<string>|string $paths The PSR-4 base directories
299 293 *
300 294 * @throws \InvalidArgumentException
301 295 *
302 296 * @return void
@@ -480,11 +474,11 @@
480 474 return $file;
481 475 }
482 476
483 477 /**
484 - * Returns the currently registered loaders indexed by their corresponding vendor directories.
478 + * Returns the currently registered loaders keyed by their corresponding vendor directories.
485 479 *
486 - * @return self[]
480 + * @return array<string, self>
487 481 */
488 482 public static function getRegisteredLoaders()
489 483 {
490 484 return self::$registeredLoaders;