@@ -42,519 +42,519 @@ discard block |
||
42 | 42 | */ |
43 | 43 | class ClassLoader |
44 | 44 | { |
45 | - /** @var ?string */ |
|
46 | - private $vendorDir; |
|
47 | - |
|
48 | - // PSR-4 |
|
49 | - /** |
|
50 | - * @var array[] |
|
51 | - * @psalm-var array<string, array<string, int>> |
|
52 | - */ |
|
53 | - private $prefixLengthsPsr4 = array(); |
|
54 | - /** |
|
55 | - * @var array[] |
|
56 | - * @psalm-var array<string, array<int, string>> |
|
57 | - */ |
|
58 | - private $prefixDirsPsr4 = array(); |
|
59 | - /** |
|
60 | - * @var array[] |
|
61 | - * @psalm-var array<string, string> |
|
62 | - */ |
|
63 | - private $fallbackDirsPsr4 = array(); |
|
64 | - |
|
65 | - // PSR-0 |
|
66 | - /** |
|
67 | - * @var array[] |
|
68 | - * @psalm-var array<string, array<string, string[]>> |
|
69 | - */ |
|
70 | - private $prefixesPsr0 = array(); |
|
71 | - /** |
|
72 | - * @var array[] |
|
73 | - * @psalm-var array<string, string> |
|
74 | - */ |
|
75 | - private $fallbackDirsPsr0 = array(); |
|
76 | - |
|
77 | - /** @var bool */ |
|
78 | - private $useIncludePath = false; |
|
79 | - |
|
80 | - /** |
|
81 | - * @var string[] |
|
82 | - * @psalm-var array<string, string> |
|
83 | - */ |
|
84 | - private $classMap = array(); |
|
85 | - |
|
86 | - /** @var bool */ |
|
87 | - private $classMapAuthoritative = false; |
|
88 | - |
|
89 | - /** |
|
90 | - * @var bool[] |
|
91 | - * @psalm-var array<string, bool> |
|
92 | - */ |
|
93 | - private $missingClasses = array(); |
|
94 | - |
|
95 | - /** @var ?string */ |
|
96 | - private $apcuPrefix; |
|
97 | - |
|
98 | - /** |
|
99 | - * @var self[] |
|
100 | - */ |
|
101 | - private static $registeredLoaders = array(); |
|
102 | - |
|
103 | - /** |
|
104 | - * @param ?string $vendorDir |
|
105 | - */ |
|
106 | - public function __construct($vendorDir = null) |
|
107 | - { |
|
108 | - $this->vendorDir = $vendorDir; |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * @return string[] |
|
113 | - */ |
|
114 | - public function getPrefixes() |
|
115 | - { |
|
116 | - if (!empty($this->prefixesPsr0)) { |
|
117 | - return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); |
|
118 | - } |
|
119 | - |
|
120 | - return array(); |
|
121 | - } |
|
122 | - |
|
123 | - /** |
|
124 | - * @return array[] |
|
125 | - * @psalm-return array<string, array<int, string>> |
|
126 | - */ |
|
127 | - public function getPrefixesPsr4() |
|
128 | - { |
|
129 | - return $this->prefixDirsPsr4; |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * @return array[] |
|
134 | - * @psalm-return array<string, string> |
|
135 | - */ |
|
136 | - public function getFallbackDirs() |
|
137 | - { |
|
138 | - return $this->fallbackDirsPsr0; |
|
139 | - } |
|
140 | - |
|
141 | - /** |
|
142 | - * @return array[] |
|
143 | - * @psalm-return array<string, string> |
|
144 | - */ |
|
145 | - public function getFallbackDirsPsr4() |
|
146 | - { |
|
147 | - return $this->fallbackDirsPsr4; |
|
148 | - } |
|
149 | - |
|
150 | - /** |
|
151 | - * @return string[] Array of classname => path |
|
152 | - * @psalm-return array<string, string> |
|
153 | - */ |
|
154 | - public function getClassMap() |
|
155 | - { |
|
156 | - return $this->classMap; |
|
157 | - } |
|
158 | - |
|
159 | - /** |
|
160 | - * @param string[] $classMap Class to filename map |
|
161 | - * @psalm-param array<string, string> $classMap |
|
162 | - * |
|
163 | - * @return void |
|
164 | - */ |
|
165 | - public function addClassMap(array $classMap) |
|
166 | - { |
|
167 | - if ($this->classMap) { |
|
168 | - $this->classMap = array_merge($this->classMap, $classMap); |
|
169 | - } else { |
|
170 | - $this->classMap = $classMap; |
|
171 | - } |
|
172 | - } |
|
173 | - |
|
174 | - /** |
|
175 | - * Registers a set of PSR-0 directories for a given prefix, either |
|
176 | - * appending or prepending to the ones previously set for this prefix. |
|
177 | - * |
|
178 | - * @param string $prefix The prefix |
|
179 | - * @param string[]|string $paths The PSR-0 root directories |
|
180 | - * @param bool $prepend Whether to prepend the directories |
|
181 | - * |
|
182 | - * @return void |
|
183 | - */ |
|
184 | - public function add($prefix, $paths, $prepend = false) |
|
185 | - { |
|
186 | - if (!$prefix) { |
|
187 | - if ($prepend) { |
|
188 | - $this->fallbackDirsPsr0 = array_merge( |
|
189 | - (array) $paths, |
|
190 | - $this->fallbackDirsPsr0 |
|
191 | - ); |
|
192 | - } else { |
|
193 | - $this->fallbackDirsPsr0 = array_merge( |
|
194 | - $this->fallbackDirsPsr0, |
|
195 | - (array) $paths |
|
196 | - ); |
|
197 | - } |
|
198 | - |
|
199 | - return; |
|
200 | - } |
|
201 | - |
|
202 | - $first = $prefix[0]; |
|
203 | - if (!isset($this->prefixesPsr0[$first][$prefix])) { |
|
204 | - $this->prefixesPsr0[$first][$prefix] = (array) $paths; |
|
205 | - |
|
206 | - return; |
|
207 | - } |
|
208 | - if ($prepend) { |
|
209 | - $this->prefixesPsr0[$first][$prefix] = array_merge( |
|
210 | - (array) $paths, |
|
211 | - $this->prefixesPsr0[$first][$prefix] |
|
212 | - ); |
|
213 | - } else { |
|
214 | - $this->prefixesPsr0[$first][$prefix] = array_merge( |
|
215 | - $this->prefixesPsr0[$first][$prefix], |
|
216 | - (array) $paths |
|
217 | - ); |
|
218 | - } |
|
219 | - } |
|
220 | - |
|
221 | - /** |
|
222 | - * Registers a set of PSR-4 directories for a given namespace, either |
|
223 | - * appending or prepending to the ones previously set for this namespace. |
|
224 | - * |
|
225 | - * @param string $prefix The prefix/namespace, with trailing '\\' |
|
226 | - * @param string[]|string $paths The PSR-4 base directories |
|
227 | - * @param bool $prepend Whether to prepend the directories |
|
228 | - * |
|
229 | - * @throws \InvalidArgumentException |
|
230 | - * |
|
231 | - * @return void |
|
232 | - */ |
|
233 | - public function addPsr4($prefix, $paths, $prepend = false) |
|
234 | - { |
|
235 | - if (!$prefix) { |
|
236 | - // Register directories for the root namespace. |
|
237 | - if ($prepend) { |
|
238 | - $this->fallbackDirsPsr4 = array_merge( |
|
239 | - (array) $paths, |
|
240 | - $this->fallbackDirsPsr4 |
|
241 | - ); |
|
242 | - } else { |
|
243 | - $this->fallbackDirsPsr4 = array_merge( |
|
244 | - $this->fallbackDirsPsr4, |
|
245 | - (array) $paths |
|
246 | - ); |
|
247 | - } |
|
248 | - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { |
|
249 | - // Register directories for a new namespace. |
|
250 | - $length = strlen($prefix); |
|
251 | - if ('\\' !== $prefix[$length - 1]) { |
|
252 | - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
|
253 | - } |
|
254 | - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
|
255 | - $this->prefixDirsPsr4[$prefix] = (array) $paths; |
|
256 | - } elseif ($prepend) { |
|
257 | - // Prepend directories for an already registered namespace. |
|
258 | - $this->prefixDirsPsr4[$prefix] = array_merge( |
|
259 | - (array) $paths, |
|
260 | - $this->prefixDirsPsr4[$prefix] |
|
261 | - ); |
|
262 | - } else { |
|
263 | - // Append directories for an already registered namespace. |
|
264 | - $this->prefixDirsPsr4[$prefix] = array_merge( |
|
265 | - $this->prefixDirsPsr4[$prefix], |
|
266 | - (array) $paths |
|
267 | - ); |
|
268 | - } |
|
269 | - } |
|
270 | - |
|
271 | - /** |
|
272 | - * Registers a set of PSR-0 directories for a given prefix, |
|
273 | - * replacing any others previously set for this prefix. |
|
274 | - * |
|
275 | - * @param string $prefix The prefix |
|
276 | - * @param string[]|string $paths The PSR-0 base directories |
|
277 | - * |
|
278 | - * @return void |
|
279 | - */ |
|
280 | - public function set($prefix, $paths) |
|
281 | - { |
|
282 | - if (!$prefix) { |
|
283 | - $this->fallbackDirsPsr0 = (array) $paths; |
|
284 | - } else { |
|
285 | - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; |
|
286 | - } |
|
287 | - } |
|
288 | - |
|
289 | - /** |
|
290 | - * Registers a set of PSR-4 directories for a given namespace, |
|
291 | - * replacing any others previously set for this namespace. |
|
292 | - * |
|
293 | - * @param string $prefix The prefix/namespace, with trailing '\\' |
|
294 | - * @param string[]|string $paths The PSR-4 base directories |
|
295 | - * |
|
296 | - * @throws \InvalidArgumentException |
|
297 | - * |
|
298 | - * @return void |
|
299 | - */ |
|
300 | - public function setPsr4($prefix, $paths) |
|
301 | - { |
|
302 | - if (!$prefix) { |
|
303 | - $this->fallbackDirsPsr4 = (array) $paths; |
|
304 | - } else { |
|
305 | - $length = strlen($prefix); |
|
306 | - if ('\\' !== $prefix[$length - 1]) { |
|
307 | - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
|
308 | - } |
|
309 | - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
|
310 | - $this->prefixDirsPsr4[$prefix] = (array) $paths; |
|
311 | - } |
|
312 | - } |
|
313 | - |
|
314 | - /** |
|
315 | - * Turns on searching the include path for class files. |
|
316 | - * |
|
317 | - * @param bool $useIncludePath |
|
318 | - * |
|
319 | - * @return void |
|
320 | - */ |
|
321 | - public function setUseIncludePath($useIncludePath) |
|
322 | - { |
|
323 | - $this->useIncludePath = $useIncludePath; |
|
324 | - } |
|
325 | - |
|
326 | - /** |
|
327 | - * Can be used to check if the autoloader uses the include path to check |
|
328 | - * for classes. |
|
329 | - * |
|
330 | - * @return bool |
|
331 | - */ |
|
332 | - public function getUseIncludePath() |
|
333 | - { |
|
334 | - return $this->useIncludePath; |
|
335 | - } |
|
336 | - |
|
337 | - /** |
|
338 | - * Turns off searching the prefix and fallback directories for classes |
|
339 | - * that have not been registered with the class map. |
|
340 | - * |
|
341 | - * @param bool $classMapAuthoritative |
|
342 | - * |
|
343 | - * @return void |
|
344 | - */ |
|
345 | - public function setClassMapAuthoritative($classMapAuthoritative) |
|
346 | - { |
|
347 | - $this->classMapAuthoritative = $classMapAuthoritative; |
|
348 | - } |
|
349 | - |
|
350 | - /** |
|
351 | - * Should class lookup fail if not found in the current class map? |
|
352 | - * |
|
353 | - * @return bool |
|
354 | - */ |
|
355 | - public function isClassMapAuthoritative() |
|
356 | - { |
|
357 | - return $this->classMapAuthoritative; |
|
358 | - } |
|
359 | - |
|
360 | - /** |
|
361 | - * APCu prefix to use to cache found/not-found classes, if the extension is enabled. |
|
362 | - * |
|
363 | - * @param string|null $apcuPrefix |
|
364 | - * |
|
365 | - * @return void |
|
366 | - */ |
|
367 | - public function setApcuPrefix($apcuPrefix) |
|
368 | - { |
|
369 | - $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; |
|
370 | - } |
|
371 | - |
|
372 | - /** |
|
373 | - * The APCu prefix in use, or null if APCu caching is not enabled. |
|
374 | - * |
|
375 | - * @return string|null |
|
376 | - */ |
|
377 | - public function getApcuPrefix() |
|
378 | - { |
|
379 | - return $this->apcuPrefix; |
|
380 | - } |
|
381 | - |
|
382 | - /** |
|
383 | - * Registers this instance as an autoloader. |
|
384 | - * |
|
385 | - * @param bool $prepend Whether to prepend the autoloader or not |
|
386 | - * |
|
387 | - * @return void |
|
388 | - */ |
|
389 | - public function register($prepend = false) |
|
390 | - { |
|
391 | - spl_autoload_register(array($this, 'loadClass'), true, $prepend); |
|
392 | - |
|
393 | - if (null === $this->vendorDir) { |
|
394 | - return; |
|
395 | - } |
|
396 | - |
|
397 | - if ($prepend) { |
|
398 | - self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; |
|
399 | - } else { |
|
400 | - unset(self::$registeredLoaders[$this->vendorDir]); |
|
401 | - self::$registeredLoaders[$this->vendorDir] = $this; |
|
402 | - } |
|
403 | - } |
|
404 | - |
|
405 | - /** |
|
406 | - * Unregisters this instance as an autoloader. |
|
407 | - * |
|
408 | - * @return void |
|
409 | - */ |
|
410 | - public function unregister() |
|
411 | - { |
|
412 | - spl_autoload_unregister(array($this, 'loadClass')); |
|
413 | - |
|
414 | - if (null !== $this->vendorDir) { |
|
415 | - unset(self::$registeredLoaders[$this->vendorDir]); |
|
416 | - } |
|
417 | - } |
|
418 | - |
|
419 | - /** |
|
420 | - * Loads the given class or interface. |
|
421 | - * |
|
422 | - * @param string $class The name of the class |
|
423 | - * @return true|null True if loaded, null otherwise |
|
424 | - */ |
|
425 | - public function loadClass($class) |
|
426 | - { |
|
427 | - if ($file = $this->findFile($class)) { |
|
428 | - includeFile($file); |
|
429 | - |
|
430 | - return true; |
|
431 | - } |
|
432 | - |
|
433 | - return null; |
|
434 | - } |
|
435 | - |
|
436 | - /** |
|
437 | - * Finds the path to the file where the class is defined. |
|
438 | - * |
|
439 | - * @param string $class The name of the class |
|
440 | - * |
|
441 | - * @return string|false The path if found, false otherwise |
|
442 | - */ |
|
443 | - public function findFile($class) |
|
444 | - { |
|
445 | - // class map lookup |
|
446 | - if (isset($this->classMap[$class])) { |
|
447 | - return $this->classMap[$class]; |
|
448 | - } |
|
449 | - if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { |
|
450 | - return false; |
|
451 | - } |
|
452 | - if (null !== $this->apcuPrefix) { |
|
453 | - $file = apcu_fetch($this->apcuPrefix.$class, $hit); |
|
454 | - if ($hit) { |
|
455 | - return $file; |
|
456 | - } |
|
457 | - } |
|
458 | - |
|
459 | - $file = $this->findFileWithExtension($class, '.php'); |
|
460 | - |
|
461 | - // Search for Hack files if we are running on HHVM |
|
462 | - if (false === $file && defined('HHVM_VERSION')) { |
|
463 | - $file = $this->findFileWithExtension($class, '.hh'); |
|
464 | - } |
|
465 | - |
|
466 | - if (null !== $this->apcuPrefix) { |
|
467 | - apcu_add($this->apcuPrefix.$class, $file); |
|
468 | - } |
|
469 | - |
|
470 | - if (false === $file) { |
|
471 | - // Remember that this class does not exist. |
|
472 | - $this->missingClasses[$class] = true; |
|
473 | - } |
|
474 | - |
|
475 | - return $file; |
|
476 | - } |
|
477 | - |
|
478 | - /** |
|
479 | - * Returns the currently registered loaders indexed by their corresponding vendor directories. |
|
480 | - * |
|
481 | - * @return self[] |
|
482 | - */ |
|
483 | - public static function getRegisteredLoaders() |
|
484 | - { |
|
485 | - return self::$registeredLoaders; |
|
486 | - } |
|
487 | - |
|
488 | - /** |
|
489 | - * @param string $class |
|
490 | - * @param string $ext |
|
491 | - * @return string|false |
|
492 | - */ |
|
493 | - private function findFileWithExtension($class, $ext) |
|
494 | - { |
|
495 | - // PSR-4 lookup |
|
496 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
497 | - |
|
498 | - $first = $class[0]; |
|
499 | - if (isset($this->prefixLengthsPsr4[$first])) { |
|
500 | - $subPath = $class; |
|
501 | - while (false !== $lastPos = strrpos($subPath, '\\')) { |
|
502 | - $subPath = substr($subPath, 0, $lastPos); |
|
503 | - $search = $subPath . '\\'; |
|
504 | - if (isset($this->prefixDirsPsr4[$search])) { |
|
505 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
506 | - foreach ($this->prefixDirsPsr4[$search] as $dir) { |
|
507 | - if (file_exists($file = $dir . $pathEnd)) { |
|
508 | - return $file; |
|
509 | - } |
|
510 | - } |
|
511 | - } |
|
512 | - } |
|
513 | - } |
|
514 | - |
|
515 | - // PSR-4 fallback dirs |
|
516 | - foreach ($this->fallbackDirsPsr4 as $dir) { |
|
517 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
518 | - return $file; |
|
519 | - } |
|
520 | - } |
|
521 | - |
|
522 | - // PSR-0 lookup |
|
523 | - if (false !== $pos = strrpos($class, '\\')) { |
|
524 | - // namespaced class name |
|
525 | - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) |
|
526 | - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
|
527 | - } else { |
|
528 | - // PEAR-like class name |
|
529 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
530 | - } |
|
531 | - |
|
532 | - if (isset($this->prefixesPsr0[$first])) { |
|
533 | - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
|
534 | - if (0 === strpos($class, $prefix)) { |
|
535 | - foreach ($dirs as $dir) { |
|
536 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
537 | - return $file; |
|
538 | - } |
|
539 | - } |
|
540 | - } |
|
541 | - } |
|
542 | - } |
|
543 | - |
|
544 | - // PSR-0 fallback dirs |
|
545 | - foreach ($this->fallbackDirsPsr0 as $dir) { |
|
546 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
547 | - return $file; |
|
548 | - } |
|
549 | - } |
|
550 | - |
|
551 | - // PSR-0 include paths. |
|
552 | - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { |
|
553 | - return $file; |
|
554 | - } |
|
555 | - |
|
556 | - return false; |
|
557 | - } |
|
45 | + /** @var ?string */ |
|
46 | + private $vendorDir; |
|
47 | + |
|
48 | + // PSR-4 |
|
49 | + /** |
|
50 | + * @var array[] |
|
51 | + * @psalm-var array<string, array<string, int>> |
|
52 | + */ |
|
53 | + private $prefixLengthsPsr4 = array(); |
|
54 | + /** |
|
55 | + * @var array[] |
|
56 | + * @psalm-var array<string, array<int, string>> |
|
57 | + */ |
|
58 | + private $prefixDirsPsr4 = array(); |
|
59 | + /** |
|
60 | + * @var array[] |
|
61 | + * @psalm-var array<string, string> |
|
62 | + */ |
|
63 | + private $fallbackDirsPsr4 = array(); |
|
64 | + |
|
65 | + // PSR-0 |
|
66 | + /** |
|
67 | + * @var array[] |
|
68 | + * @psalm-var array<string, array<string, string[]>> |
|
69 | + */ |
|
70 | + private $prefixesPsr0 = array(); |
|
71 | + /** |
|
72 | + * @var array[] |
|
73 | + * @psalm-var array<string, string> |
|
74 | + */ |
|
75 | + private $fallbackDirsPsr0 = array(); |
|
76 | + |
|
77 | + /** @var bool */ |
|
78 | + private $useIncludePath = false; |
|
79 | + |
|
80 | + /** |
|
81 | + * @var string[] |
|
82 | + * @psalm-var array<string, string> |
|
83 | + */ |
|
84 | + private $classMap = array(); |
|
85 | + |
|
86 | + /** @var bool */ |
|
87 | + private $classMapAuthoritative = false; |
|
88 | + |
|
89 | + /** |
|
90 | + * @var bool[] |
|
91 | + * @psalm-var array<string, bool> |
|
92 | + */ |
|
93 | + private $missingClasses = array(); |
|
94 | + |
|
95 | + /** @var ?string */ |
|
96 | + private $apcuPrefix; |
|
97 | + |
|
98 | + /** |
|
99 | + * @var self[] |
|
100 | + */ |
|
101 | + private static $registeredLoaders = array(); |
|
102 | + |
|
103 | + /** |
|
104 | + * @param ?string $vendorDir |
|
105 | + */ |
|
106 | + public function __construct($vendorDir = null) |
|
107 | + { |
|
108 | + $this->vendorDir = $vendorDir; |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * @return string[] |
|
113 | + */ |
|
114 | + public function getPrefixes() |
|
115 | + { |
|
116 | + if (!empty($this->prefixesPsr0)) { |
|
117 | + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); |
|
118 | + } |
|
119 | + |
|
120 | + return array(); |
|
121 | + } |
|
122 | + |
|
123 | + /** |
|
124 | + * @return array[] |
|
125 | + * @psalm-return array<string, array<int, string>> |
|
126 | + */ |
|
127 | + public function getPrefixesPsr4() |
|
128 | + { |
|
129 | + return $this->prefixDirsPsr4; |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * @return array[] |
|
134 | + * @psalm-return array<string, string> |
|
135 | + */ |
|
136 | + public function getFallbackDirs() |
|
137 | + { |
|
138 | + return $this->fallbackDirsPsr0; |
|
139 | + } |
|
140 | + |
|
141 | + /** |
|
142 | + * @return array[] |
|
143 | + * @psalm-return array<string, string> |
|
144 | + */ |
|
145 | + public function getFallbackDirsPsr4() |
|
146 | + { |
|
147 | + return $this->fallbackDirsPsr4; |
|
148 | + } |
|
149 | + |
|
150 | + /** |
|
151 | + * @return string[] Array of classname => path |
|
152 | + * @psalm-return array<string, string> |
|
153 | + */ |
|
154 | + public function getClassMap() |
|
155 | + { |
|
156 | + return $this->classMap; |
|
157 | + } |
|
158 | + |
|
159 | + /** |
|
160 | + * @param string[] $classMap Class to filename map |
|
161 | + * @psalm-param array<string, string> $classMap |
|
162 | + * |
|
163 | + * @return void |
|
164 | + */ |
|
165 | + public function addClassMap(array $classMap) |
|
166 | + { |
|
167 | + if ($this->classMap) { |
|
168 | + $this->classMap = array_merge($this->classMap, $classMap); |
|
169 | + } else { |
|
170 | + $this->classMap = $classMap; |
|
171 | + } |
|
172 | + } |
|
173 | + |
|
174 | + /** |
|
175 | + * Registers a set of PSR-0 directories for a given prefix, either |
|
176 | + * appending or prepending to the ones previously set for this prefix. |
|
177 | + * |
|
178 | + * @param string $prefix The prefix |
|
179 | + * @param string[]|string $paths The PSR-0 root directories |
|
180 | + * @param bool $prepend Whether to prepend the directories |
|
181 | + * |
|
182 | + * @return void |
|
183 | + */ |
|
184 | + public function add($prefix, $paths, $prepend = false) |
|
185 | + { |
|
186 | + if (!$prefix) { |
|
187 | + if ($prepend) { |
|
188 | + $this->fallbackDirsPsr0 = array_merge( |
|
189 | + (array) $paths, |
|
190 | + $this->fallbackDirsPsr0 |
|
191 | + ); |
|
192 | + } else { |
|
193 | + $this->fallbackDirsPsr0 = array_merge( |
|
194 | + $this->fallbackDirsPsr0, |
|
195 | + (array) $paths |
|
196 | + ); |
|
197 | + } |
|
198 | + |
|
199 | + return; |
|
200 | + } |
|
201 | + |
|
202 | + $first = $prefix[0]; |
|
203 | + if (!isset($this->prefixesPsr0[$first][$prefix])) { |
|
204 | + $this->prefixesPsr0[$first][$prefix] = (array) $paths; |
|
205 | + |
|
206 | + return; |
|
207 | + } |
|
208 | + if ($prepend) { |
|
209 | + $this->prefixesPsr0[$first][$prefix] = array_merge( |
|
210 | + (array) $paths, |
|
211 | + $this->prefixesPsr0[$first][$prefix] |
|
212 | + ); |
|
213 | + } else { |
|
214 | + $this->prefixesPsr0[$first][$prefix] = array_merge( |
|
215 | + $this->prefixesPsr0[$first][$prefix], |
|
216 | + (array) $paths |
|
217 | + ); |
|
218 | + } |
|
219 | + } |
|
220 | + |
|
221 | + /** |
|
222 | + * Registers a set of PSR-4 directories for a given namespace, either |
|
223 | + * appending or prepending to the ones previously set for this namespace. |
|
224 | + * |
|
225 | + * @param string $prefix The prefix/namespace, with trailing '\\' |
|
226 | + * @param string[]|string $paths The PSR-4 base directories |
|
227 | + * @param bool $prepend Whether to prepend the directories |
|
228 | + * |
|
229 | + * @throws \InvalidArgumentException |
|
230 | + * |
|
231 | + * @return void |
|
232 | + */ |
|
233 | + public function addPsr4($prefix, $paths, $prepend = false) |
|
234 | + { |
|
235 | + if (!$prefix) { |
|
236 | + // Register directories for the root namespace. |
|
237 | + if ($prepend) { |
|
238 | + $this->fallbackDirsPsr4 = array_merge( |
|
239 | + (array) $paths, |
|
240 | + $this->fallbackDirsPsr4 |
|
241 | + ); |
|
242 | + } else { |
|
243 | + $this->fallbackDirsPsr4 = array_merge( |
|
244 | + $this->fallbackDirsPsr4, |
|
245 | + (array) $paths |
|
246 | + ); |
|
247 | + } |
|
248 | + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { |
|
249 | + // Register directories for a new namespace. |
|
250 | + $length = strlen($prefix); |
|
251 | + if ('\\' !== $prefix[$length - 1]) { |
|
252 | + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
|
253 | + } |
|
254 | + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
|
255 | + $this->prefixDirsPsr4[$prefix] = (array) $paths; |
|
256 | + } elseif ($prepend) { |
|
257 | + // Prepend directories for an already registered namespace. |
|
258 | + $this->prefixDirsPsr4[$prefix] = array_merge( |
|
259 | + (array) $paths, |
|
260 | + $this->prefixDirsPsr4[$prefix] |
|
261 | + ); |
|
262 | + } else { |
|
263 | + // Append directories for an already registered namespace. |
|
264 | + $this->prefixDirsPsr4[$prefix] = array_merge( |
|
265 | + $this->prefixDirsPsr4[$prefix], |
|
266 | + (array) $paths |
|
267 | + ); |
|
268 | + } |
|
269 | + } |
|
270 | + |
|
271 | + /** |
|
272 | + * Registers a set of PSR-0 directories for a given prefix, |
|
273 | + * replacing any others previously set for this prefix. |
|
274 | + * |
|
275 | + * @param string $prefix The prefix |
|
276 | + * @param string[]|string $paths The PSR-0 base directories |
|
277 | + * |
|
278 | + * @return void |
|
279 | + */ |
|
280 | + public function set($prefix, $paths) |
|
281 | + { |
|
282 | + if (!$prefix) { |
|
283 | + $this->fallbackDirsPsr0 = (array) $paths; |
|
284 | + } else { |
|
285 | + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; |
|
286 | + } |
|
287 | + } |
|
288 | + |
|
289 | + /** |
|
290 | + * Registers a set of PSR-4 directories for a given namespace, |
|
291 | + * replacing any others previously set for this namespace. |
|
292 | + * |
|
293 | + * @param string $prefix The prefix/namespace, with trailing '\\' |
|
294 | + * @param string[]|string $paths The PSR-4 base directories |
|
295 | + * |
|
296 | + * @throws \InvalidArgumentException |
|
297 | + * |
|
298 | + * @return void |
|
299 | + */ |
|
300 | + public function setPsr4($prefix, $paths) |
|
301 | + { |
|
302 | + if (!$prefix) { |
|
303 | + $this->fallbackDirsPsr4 = (array) $paths; |
|
304 | + } else { |
|
305 | + $length = strlen($prefix); |
|
306 | + if ('\\' !== $prefix[$length - 1]) { |
|
307 | + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
|
308 | + } |
|
309 | + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
|
310 | + $this->prefixDirsPsr4[$prefix] = (array) $paths; |
|
311 | + } |
|
312 | + } |
|
313 | + |
|
314 | + /** |
|
315 | + * Turns on searching the include path for class files. |
|
316 | + * |
|
317 | + * @param bool $useIncludePath |
|
318 | + * |
|
319 | + * @return void |
|
320 | + */ |
|
321 | + public function setUseIncludePath($useIncludePath) |
|
322 | + { |
|
323 | + $this->useIncludePath = $useIncludePath; |
|
324 | + } |
|
325 | + |
|
326 | + /** |
|
327 | + * Can be used to check if the autoloader uses the include path to check |
|
328 | + * for classes. |
|
329 | + * |
|
330 | + * @return bool |
|
331 | + */ |
|
332 | + public function getUseIncludePath() |
|
333 | + { |
|
334 | + return $this->useIncludePath; |
|
335 | + } |
|
336 | + |
|
337 | + /** |
|
338 | + * Turns off searching the prefix and fallback directories for classes |
|
339 | + * that have not been registered with the class map. |
|
340 | + * |
|
341 | + * @param bool $classMapAuthoritative |
|
342 | + * |
|
343 | + * @return void |
|
344 | + */ |
|
345 | + public function setClassMapAuthoritative($classMapAuthoritative) |
|
346 | + { |
|
347 | + $this->classMapAuthoritative = $classMapAuthoritative; |
|
348 | + } |
|
349 | + |
|
350 | + /** |
|
351 | + * Should class lookup fail if not found in the current class map? |
|
352 | + * |
|
353 | + * @return bool |
|
354 | + */ |
|
355 | + public function isClassMapAuthoritative() |
|
356 | + { |
|
357 | + return $this->classMapAuthoritative; |
|
358 | + } |
|
359 | + |
|
360 | + /** |
|
361 | + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. |
|
362 | + * |
|
363 | + * @param string|null $apcuPrefix |
|
364 | + * |
|
365 | + * @return void |
|
366 | + */ |
|
367 | + public function setApcuPrefix($apcuPrefix) |
|
368 | + { |
|
369 | + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; |
|
370 | + } |
|
371 | + |
|
372 | + /** |
|
373 | + * The APCu prefix in use, or null if APCu caching is not enabled. |
|
374 | + * |
|
375 | + * @return string|null |
|
376 | + */ |
|
377 | + public function getApcuPrefix() |
|
378 | + { |
|
379 | + return $this->apcuPrefix; |
|
380 | + } |
|
381 | + |
|
382 | + /** |
|
383 | + * Registers this instance as an autoloader. |
|
384 | + * |
|
385 | + * @param bool $prepend Whether to prepend the autoloader or not |
|
386 | + * |
|
387 | + * @return void |
|
388 | + */ |
|
389 | + public function register($prepend = false) |
|
390 | + { |
|
391 | + spl_autoload_register(array($this, 'loadClass'), true, $prepend); |
|
392 | + |
|
393 | + if (null === $this->vendorDir) { |
|
394 | + return; |
|
395 | + } |
|
396 | + |
|
397 | + if ($prepend) { |
|
398 | + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; |
|
399 | + } else { |
|
400 | + unset(self::$registeredLoaders[$this->vendorDir]); |
|
401 | + self::$registeredLoaders[$this->vendorDir] = $this; |
|
402 | + } |
|
403 | + } |
|
404 | + |
|
405 | + /** |
|
406 | + * Unregisters this instance as an autoloader. |
|
407 | + * |
|
408 | + * @return void |
|
409 | + */ |
|
410 | + public function unregister() |
|
411 | + { |
|
412 | + spl_autoload_unregister(array($this, 'loadClass')); |
|
413 | + |
|
414 | + if (null !== $this->vendorDir) { |
|
415 | + unset(self::$registeredLoaders[$this->vendorDir]); |
|
416 | + } |
|
417 | + } |
|
418 | + |
|
419 | + /** |
|
420 | + * Loads the given class or interface. |
|
421 | + * |
|
422 | + * @param string $class The name of the class |
|
423 | + * @return true|null True if loaded, null otherwise |
|
424 | + */ |
|
425 | + public function loadClass($class) |
|
426 | + { |
|
427 | + if ($file = $this->findFile($class)) { |
|
428 | + includeFile($file); |
|
429 | + |
|
430 | + return true; |
|
431 | + } |
|
432 | + |
|
433 | + return null; |
|
434 | + } |
|
435 | + |
|
436 | + /** |
|
437 | + * Finds the path to the file where the class is defined. |
|
438 | + * |
|
439 | + * @param string $class The name of the class |
|
440 | + * |
|
441 | + * @return string|false The path if found, false otherwise |
|
442 | + */ |
|
443 | + public function findFile($class) |
|
444 | + { |
|
445 | + // class map lookup |
|
446 | + if (isset($this->classMap[$class])) { |
|
447 | + return $this->classMap[$class]; |
|
448 | + } |
|
449 | + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { |
|
450 | + return false; |
|
451 | + } |
|
452 | + if (null !== $this->apcuPrefix) { |
|
453 | + $file = apcu_fetch($this->apcuPrefix.$class, $hit); |
|
454 | + if ($hit) { |
|
455 | + return $file; |
|
456 | + } |
|
457 | + } |
|
458 | + |
|
459 | + $file = $this->findFileWithExtension($class, '.php'); |
|
460 | + |
|
461 | + // Search for Hack files if we are running on HHVM |
|
462 | + if (false === $file && defined('HHVM_VERSION')) { |
|
463 | + $file = $this->findFileWithExtension($class, '.hh'); |
|
464 | + } |
|
465 | + |
|
466 | + if (null !== $this->apcuPrefix) { |
|
467 | + apcu_add($this->apcuPrefix.$class, $file); |
|
468 | + } |
|
469 | + |
|
470 | + if (false === $file) { |
|
471 | + // Remember that this class does not exist. |
|
472 | + $this->missingClasses[$class] = true; |
|
473 | + } |
|
474 | + |
|
475 | + return $file; |
|
476 | + } |
|
477 | + |
|
478 | + /** |
|
479 | + * Returns the currently registered loaders indexed by their corresponding vendor directories. |
|
480 | + * |
|
481 | + * @return self[] |
|
482 | + */ |
|
483 | + public static function getRegisteredLoaders() |
|
484 | + { |
|
485 | + return self::$registeredLoaders; |
|
486 | + } |
|
487 | + |
|
488 | + /** |
|
489 | + * @param string $class |
|
490 | + * @param string $ext |
|
491 | + * @return string|false |
|
492 | + */ |
|
493 | + private function findFileWithExtension($class, $ext) |
|
494 | + { |
|
495 | + // PSR-4 lookup |
|
496 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
497 | + |
|
498 | + $first = $class[0]; |
|
499 | + if (isset($this->prefixLengthsPsr4[$first])) { |
|
500 | + $subPath = $class; |
|
501 | + while (false !== $lastPos = strrpos($subPath, '\\')) { |
|
502 | + $subPath = substr($subPath, 0, $lastPos); |
|
503 | + $search = $subPath . '\\'; |
|
504 | + if (isset($this->prefixDirsPsr4[$search])) { |
|
505 | + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
506 | + foreach ($this->prefixDirsPsr4[$search] as $dir) { |
|
507 | + if (file_exists($file = $dir . $pathEnd)) { |
|
508 | + return $file; |
|
509 | + } |
|
510 | + } |
|
511 | + } |
|
512 | + } |
|
513 | + } |
|
514 | + |
|
515 | + // PSR-4 fallback dirs |
|
516 | + foreach ($this->fallbackDirsPsr4 as $dir) { |
|
517 | + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
518 | + return $file; |
|
519 | + } |
|
520 | + } |
|
521 | + |
|
522 | + // PSR-0 lookup |
|
523 | + if (false !== $pos = strrpos($class, '\\')) { |
|
524 | + // namespaced class name |
|
525 | + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) |
|
526 | + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
|
527 | + } else { |
|
528 | + // PEAR-like class name |
|
529 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
530 | + } |
|
531 | + |
|
532 | + if (isset($this->prefixesPsr0[$first])) { |
|
533 | + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
|
534 | + if (0 === strpos($class, $prefix)) { |
|
535 | + foreach ($dirs as $dir) { |
|
536 | + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
537 | + return $file; |
|
538 | + } |
|
539 | + } |
|
540 | + } |
|
541 | + } |
|
542 | + } |
|
543 | + |
|
544 | + // PSR-0 fallback dirs |
|
545 | + foreach ($this->fallbackDirsPsr0 as $dir) { |
|
546 | + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
547 | + return $file; |
|
548 | + } |
|
549 | + } |
|
550 | + |
|
551 | + // PSR-0 include paths. |
|
552 | + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { |
|
553 | + return $file; |
|
554 | + } |
|
555 | + |
|
556 | + return false; |
|
557 | + } |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | /** |
@@ -568,5 +568,5 @@ discard block |
||
568 | 568 | */ |
569 | 569 | function includeFile($file) |
570 | 570 | { |
571 | - include $file; |
|
571 | + include $file; |
|
572 | 572 | } |
@@ -493,18 +493,18 @@ discard block |
||
493 | 493 | private function findFileWithExtension($class, $ext) |
494 | 494 | { |
495 | 495 | // PSR-4 lookup |
496 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
496 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
497 | 497 | |
498 | 498 | $first = $class[0]; |
499 | 499 | if (isset($this->prefixLengthsPsr4[$first])) { |
500 | 500 | $subPath = $class; |
501 | 501 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
502 | 502 | $subPath = substr($subPath, 0, $lastPos); |
503 | - $search = $subPath . '\\'; |
|
503 | + $search = $subPath.'\\'; |
|
504 | 504 | if (isset($this->prefixDirsPsr4[$search])) { |
505 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
505 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
506 | 506 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
507 | - if (file_exists($file = $dir . $pathEnd)) { |
|
507 | + if (file_exists($file = $dir.$pathEnd)) { |
|
508 | 508 | return $file; |
509 | 509 | } |
510 | 510 | } |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | |
515 | 515 | // PSR-4 fallback dirs |
516 | 516 | foreach ($this->fallbackDirsPsr4 as $dir) { |
517 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
517 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
518 | 518 | return $file; |
519 | 519 | } |
520 | 520 | } |
@@ -526,14 +526,14 @@ discard block |
||
526 | 526 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
527 | 527 | } else { |
528 | 528 | // PEAR-like class name |
529 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
529 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
530 | 530 | } |
531 | 531 | |
532 | 532 | if (isset($this->prefixesPsr0[$first])) { |
533 | 533 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
534 | 534 | if (0 === strpos($class, $prefix)) { |
535 | 535 | foreach ($dirs as $dir) { |
536 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
536 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
537 | 537 | return $file; |
538 | 538 | } |
539 | 539 | } |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | |
544 | 544 | // PSR-0 fallback dirs |
545 | 545 | foreach ($this->fallbackDirsPsr0 as $dir) { |
546 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
546 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
547 | 547 | return $file; |
548 | 548 | } |
549 | 549 | } |
@@ -6,25 +6,25 @@ |
||
6 | 6 | $baseDir = dirname($vendorDir); |
7 | 7 | |
8 | 8 | return array( |
9 | - 'voku\\' => array($vendorDir . '/voku/portable-ascii/src/voku'), |
|
10 | - 'phpDocumentor\\Reflection\\' => array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/type-resolver/src', $vendorDir . '/phpdocumentor/reflection-docblock/src'), |
|
11 | - 'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'), |
|
12 | - 'Webklex\\PHPIMAP\\' => array($baseDir . '/src'), |
|
13 | - 'Tests\\' => array($baseDir . '/tests'), |
|
14 | - 'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'), |
|
15 | - 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), |
|
16 | - 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), |
|
17 | - 'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'), |
|
18 | - 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), |
|
19 | - 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), |
|
20 | - 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), |
|
21 | - 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), |
|
22 | - 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), |
|
23 | - 'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src/Prophecy'), |
|
24 | - 'Illuminate\\Support\\' => array($vendorDir . '/illuminate/macroable', $vendorDir . '/illuminate/collections', $vendorDir . '/illuminate/support'), |
|
25 | - 'Illuminate\\Pagination\\' => array($vendorDir . '/illuminate/pagination'), |
|
26 | - 'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'), |
|
27 | - 'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'), |
|
28 | - 'Doctrine\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Inflector'), |
|
29 | - 'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'), |
|
9 | + 'voku\\' => array($vendorDir . '/voku/portable-ascii/src/voku'), |
|
10 | + 'phpDocumentor\\Reflection\\' => array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/type-resolver/src', $vendorDir . '/phpdocumentor/reflection-docblock/src'), |
|
11 | + 'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'), |
|
12 | + 'Webklex\\PHPIMAP\\' => array($baseDir . '/src'), |
|
13 | + 'Tests\\' => array($baseDir . '/tests'), |
|
14 | + 'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'), |
|
15 | + 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), |
|
16 | + 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), |
|
17 | + 'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'), |
|
18 | + 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), |
|
19 | + 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), |
|
20 | + 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), |
|
21 | + 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), |
|
22 | + 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), |
|
23 | + 'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src/Prophecy'), |
|
24 | + 'Illuminate\\Support\\' => array($vendorDir . '/illuminate/macroable', $vendorDir . '/illuminate/collections', $vendorDir . '/illuminate/support'), |
|
25 | + 'Illuminate\\Pagination\\' => array($vendorDir . '/illuminate/pagination'), |
|
26 | + 'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'), |
|
27 | + 'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'), |
|
28 | + 'Doctrine\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Inflector'), |
|
29 | + 'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'), |
|
30 | 30 | ); |
@@ -6,25 +6,25 @@ |
||
6 | 6 | $baseDir = dirname($vendorDir); |
7 | 7 | |
8 | 8 | return array( |
9 | - 'voku\\' => array($vendorDir . '/voku/portable-ascii/src/voku'), |
|
10 | - 'phpDocumentor\\Reflection\\' => array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/type-resolver/src', $vendorDir . '/phpdocumentor/reflection-docblock/src'), |
|
11 | - 'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'), |
|
12 | - 'Webklex\\PHPIMAP\\' => array($baseDir . '/src'), |
|
13 | - 'Tests\\' => array($baseDir . '/tests'), |
|
14 | - 'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'), |
|
15 | - 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), |
|
16 | - 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), |
|
17 | - 'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'), |
|
18 | - 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), |
|
19 | - 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), |
|
20 | - 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), |
|
21 | - 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), |
|
22 | - 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), |
|
23 | - 'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src/Prophecy'), |
|
24 | - 'Illuminate\\Support\\' => array($vendorDir . '/illuminate/macroable', $vendorDir . '/illuminate/collections', $vendorDir . '/illuminate/support'), |
|
25 | - 'Illuminate\\Pagination\\' => array($vendorDir . '/illuminate/pagination'), |
|
26 | - 'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'), |
|
27 | - 'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'), |
|
28 | - 'Doctrine\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Inflector'), |
|
29 | - 'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'), |
|
9 | + 'voku\\' => array($vendorDir.'/voku/portable-ascii/src/voku'), |
|
10 | + 'phpDocumentor\\Reflection\\' => array($vendorDir.'/phpdocumentor/reflection-common/src', $vendorDir.'/phpdocumentor/type-resolver/src', $vendorDir.'/phpdocumentor/reflection-docblock/src'), |
|
11 | + 'Webmozart\\Assert\\' => array($vendorDir.'/webmozart/assert/src'), |
|
12 | + 'Webklex\\PHPIMAP\\' => array($baseDir.'/src'), |
|
13 | + 'Tests\\' => array($baseDir.'/tests'), |
|
14 | + 'Symfony\\Polyfill\\Php80\\' => array($vendorDir.'/symfony/polyfill-php80'), |
|
15 | + 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir.'/symfony/polyfill-mbstring'), |
|
16 | + 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir.'/symfony/polyfill-ctype'), |
|
17 | + 'Symfony\\Contracts\\Translation\\' => array($vendorDir.'/symfony/translation-contracts'), |
|
18 | + 'Symfony\\Component\\Yaml\\' => array($vendorDir.'/symfony/yaml'), |
|
19 | + 'Symfony\\Component\\Translation\\' => array($vendorDir.'/symfony/translation'), |
|
20 | + 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir.'/symfony/http-foundation'), |
|
21 | + 'Psr\\SimpleCache\\' => array($vendorDir.'/psr/simple-cache/src'), |
|
22 | + 'Psr\\Container\\' => array($vendorDir.'/psr/container/src'), |
|
23 | + 'Prophecy\\' => array($vendorDir.'/phpspec/prophecy/src/Prophecy'), |
|
24 | + 'Illuminate\\Support\\' => array($vendorDir.'/illuminate/macroable', $vendorDir.'/illuminate/collections', $vendorDir.'/illuminate/support'), |
|
25 | + 'Illuminate\\Pagination\\' => array($vendorDir.'/illuminate/pagination'), |
|
26 | + 'Illuminate\\Contracts\\' => array($vendorDir.'/illuminate/contracts'), |
|
27 | + 'Doctrine\\Instantiator\\' => array($vendorDir.'/doctrine/instantiator/src/Doctrine/Instantiator'), |
|
28 | + 'Doctrine\\Inflector\\' => array($vendorDir.'/doctrine/inflector/lib/Doctrine/Inflector'), |
|
29 | + 'Carbon\\' => array($vendorDir.'/nesbot/carbon/src/Carbon'), |
|
30 | 30 | ); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | require_once(__DIR__.'/illuminate/collections/helpers.php'); |
26 | 26 | |
27 | 27 | |
28 | -spl_autoload_register(function ($class_name) { |
|
28 | +spl_autoload_register(function($class_name) { |
|
29 | 29 | // Enable this to detect what we need for require_once |
30 | 30 | //var_dump($class_name); |
31 | 31 | |
@@ -34,28 +34,28 @@ discard block |
||
34 | 34 | if (1 === $preg_match) { |
35 | 35 | $class_name = preg_replace('/\\\/', '/', $class_name); |
36 | 36 | $class_name = preg_replace('/^Symfony\\/Polyfill\\/Php80\\//', '', $class_name); |
37 | - require_once __DIR__ . '/symfony/polyfill-php80/' . $class_name . '.php'; |
|
37 | + require_once __DIR__.'/symfony/polyfill-php80/'.$class_name.'.php'; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $preg_match = preg_match('/^Webklex\\\PHPIMAP\\\/', $class_name); |
41 | 41 | if (1 === $preg_match) { |
42 | 42 | $class_name = preg_replace('/\\\/', '/', $class_name); |
43 | 43 | $class_name = preg_replace('/^Webklex\\/PHPIMAP\\//', '', $class_name); |
44 | - require_once __DIR__ . '/../src/' . $class_name . '.php'; |
|
44 | + require_once __DIR__.'/../src/'.$class_name.'.php'; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $preg_match = preg_match('/^Illuminate\\\Support\\\/', $class_name); |
48 | 48 | if (1 === $preg_match) { |
49 | 49 | $class_name = preg_replace('/\\\/', '/', $class_name); |
50 | 50 | $class_name = preg_replace('/^Illuminate\\/Support\\//', '', $class_name); |
51 | - $listofdir = array(0 => __DIR__ . '/illuminate/macroable', |
|
52 | - 1 => __DIR__ . '/illuminate/collections', |
|
53 | - 2 => __DIR__ . '/illuminate/support', |
|
54 | - 3 => __DIR__ . '/illuminate/contracts' |
|
51 | + $listofdir = array(0 => __DIR__.'/illuminate/macroable', |
|
52 | + 1 => __DIR__.'/illuminate/collections', |
|
53 | + 2 => __DIR__.'/illuminate/support', |
|
54 | + 3 => __DIR__.'/illuminate/contracts' |
|
55 | 55 | ); |
56 | - foreach($listofdir as $dir) { |
|
57 | - if (file_exists($dir . '/' . $class_name . '.php')) { |
|
58 | - require_once $dir . '/' . $class_name . '.php'; |
|
56 | + foreach ($listofdir as $dir) { |
|
57 | + if (file_exists($dir.'/'.$class_name.'.php')) { |
|
58 | + require_once $dir.'/'.$class_name.'.php'; |
|
59 | 59 | break; |
60 | 60 | } |
61 | 61 | } |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | $class_name = preg_replace('/\\\/', '/', $class_name); |
67 | 67 | $class_name = preg_replace('/^Illuminate\\/Contracts\\//', '', $class_name); |
68 | 68 | $listofdir = array( |
69 | - 0 => __DIR__ . '/illuminate/contracts' |
|
69 | + 0 => __DIR__.'/illuminate/contracts' |
|
70 | 70 | ); |
71 | - foreach($listofdir as $dir) { |
|
72 | - if (file_exists($dir . '/' . $class_name . '.php')) { |
|
73 | - require_once $dir . '/' . $class_name . '.php'; |
|
71 | + foreach ($listofdir as $dir) { |
|
72 | + if (file_exists($dir.'/'.$class_name.'.php')) { |
|
73 | + require_once $dir.'/'.$class_name.'.php'; |
|
74 | 74 | break; |
75 | 75 | } |
76 | 76 | } |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | $class_name = preg_replace('/\\\/', '/', $class_name); |
82 | 82 | $class_name = preg_replace('/^Carbon\\//', '', $class_name); |
83 | 83 | $listofdir = array( |
84 | - 0 => __DIR__ . '/nesbot/carbon/src/Carbon' |
|
84 | + 0 => __DIR__.'/nesbot/carbon/src/Carbon' |
|
85 | 85 | ); |
86 | - foreach($listofdir as $dir) { |
|
87 | - if (file_exists($dir . '/' . $class_name . '.php')) { |
|
88 | - require_once $dir . '/' . $class_name . '.php'; |
|
86 | + foreach ($listofdir as $dir) { |
|
87 | + if (file_exists($dir.'/'.$class_name.'.php')) { |
|
88 | + require_once $dir.'/'.$class_name.'.php'; |
|
89 | 89 | break; |
90 | 90 | } |
91 | 91 | } |
@@ -10,18 +10,18 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | if (!function_exists('trigger_deprecation')) { |
13 | - /** |
|
14 | - * Triggers a silenced deprecation notice. |
|
15 | - * |
|
16 | - * @param string $package The name of the Composer package that is triggering the deprecation |
|
17 | - * @param string $version The version of the package that introduced the deprecation |
|
18 | - * @param string $message The message of the deprecation |
|
19 | - * @param mixed ...$args Values to insert in the message using printf() formatting |
|
20 | - * |
|
21 | - * @author Nicolas Grekas <[email protected]> |
|
22 | - */ |
|
23 | - function trigger_deprecation(string $package, string $version, string $message, ...$args): void |
|
24 | - { |
|
25 | - @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); |
|
26 | - } |
|
13 | + /** |
|
14 | + * Triggers a silenced deprecation notice. |
|
15 | + * |
|
16 | + * @param string $package The name of the Composer package that is triggering the deprecation |
|
17 | + * @param string $version The version of the package that introduced the deprecation |
|
18 | + * @param string $message The message of the deprecation |
|
19 | + * @param mixed ...$args Values to insert in the message using printf() formatting |
|
20 | + * |
|
21 | + * @author Nicolas Grekas <[email protected]> |
|
22 | + */ |
|
23 | + function trigger_deprecation(string $package, string $version, string $message, ...$args): void |
|
24 | + { |
|
25 | + @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); |
|
26 | + } |
|
27 | 27 | } |
@@ -22,6 +22,6 @@ |
||
22 | 22 | */ |
23 | 23 | function trigger_deprecation(string $package, string $version, string $message, ...$args): void |
24 | 24 | { |
25 | - @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); |
|
25 | + @trigger_error(($package || $version ? "since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); |
|
26 | 26 | } |
27 | 27 | } |
@@ -12,31 +12,31 @@ |
||
12 | 12 | use Symfony\Polyfill\Php80 as p; |
13 | 13 | |
14 | 14 | if (\PHP_VERSION_ID >= 80000) { |
15 | - return; |
|
15 | + return; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | if (!defined('FILTER_VALIDATE_BOOL') && defined('FILTER_VALIDATE_BOOLEAN')) { |
19 | - define('FILTER_VALIDATE_BOOL', \FILTER_VALIDATE_BOOLEAN); |
|
19 | + define('FILTER_VALIDATE_BOOL', \FILTER_VALIDATE_BOOLEAN); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | if (!function_exists('fdiv')) { |
23 | - function fdiv(float $num1, float $num2): float { return p\Php80::fdiv($num1, $num2); } |
|
23 | + function fdiv(float $num1, float $num2): float { return p\Php80::fdiv($num1, $num2); } |
|
24 | 24 | } |
25 | 25 | if (!function_exists('preg_last_error_msg')) { |
26 | - function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); } |
|
26 | + function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); } |
|
27 | 27 | } |
28 | 28 | if (!function_exists('str_contains')) { |
29 | - function str_contains($haystack, $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); } |
|
29 | + function str_contains($haystack, $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); } |
|
30 | 30 | } |
31 | 31 | if (!function_exists('str_starts_with')) { |
32 | - function str_starts_with($haystack, $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); } |
|
32 | + function str_starts_with($haystack, $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); } |
|
33 | 33 | } |
34 | 34 | if (!function_exists('str_ends_with')) { |
35 | - function str_ends_with($haystack, $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); } |
|
35 | + function str_ends_with($haystack, $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); } |
|
36 | 36 | } |
37 | 37 | if (!function_exists('get_debug_type')) { |
38 | - function get_debug_type($value): string { return p\Php80::get_debug_type($value); } |
|
38 | + function get_debug_type($value): string { return p\Php80::get_debug_type($value); } |
|
39 | 39 | } |
40 | 40 | if (!function_exists('get_resource_id')) { |
41 | - function get_resource_id($resource): int { return p\Php80::get_resource_id($resource); } |
|
41 | + function get_resource_id($resource): int { return p\Php80::get_resource_id($resource); } |
|
42 | 42 | } |
@@ -18,86 +18,86 @@ |
||
18 | 18 | */ |
19 | 19 | class PhpToken implements \Stringable |
20 | 20 | { |
21 | - /** |
|
22 | - * @var int |
|
23 | - */ |
|
24 | - public $id; |
|
21 | + /** |
|
22 | + * @var int |
|
23 | + */ |
|
24 | + public $id; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - public $text; |
|
26 | + /** |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + public $text; |
|
30 | 30 | |
31 | - /** |
|
32 | - * @var int |
|
33 | - */ |
|
34 | - public $line; |
|
31 | + /** |
|
32 | + * @var int |
|
33 | + */ |
|
34 | + public $line; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @var int |
|
38 | - */ |
|
39 | - public $pos; |
|
36 | + /** |
|
37 | + * @var int |
|
38 | + */ |
|
39 | + public $pos; |
|
40 | 40 | |
41 | - public function __construct(int $id, string $text, int $line = -1, int $position = -1) |
|
42 | - { |
|
43 | - $this->id = $id; |
|
44 | - $this->text = $text; |
|
45 | - $this->line = $line; |
|
46 | - $this->pos = $position; |
|
47 | - } |
|
41 | + public function __construct(int $id, string $text, int $line = -1, int $position = -1) |
|
42 | + { |
|
43 | + $this->id = $id; |
|
44 | + $this->text = $text; |
|
45 | + $this->line = $line; |
|
46 | + $this->pos = $position; |
|
47 | + } |
|
48 | 48 | |
49 | - public function getTokenName(): ?string |
|
50 | - { |
|
51 | - if ('UNKNOWN' === $name = token_name($this->id)) { |
|
52 | - $name = \strlen($this->text) > 1 || \ord($this->text) < 32 ? null : $this->text; |
|
53 | - } |
|
49 | + public function getTokenName(): ?string |
|
50 | + { |
|
51 | + if ('UNKNOWN' === $name = token_name($this->id)) { |
|
52 | + $name = \strlen($this->text) > 1 || \ord($this->text) < 32 ? null : $this->text; |
|
53 | + } |
|
54 | 54 | |
55 | - return $name; |
|
56 | - } |
|
55 | + return $name; |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @param int|string|array $kind |
|
60 | - */ |
|
61 | - public function is($kind): bool |
|
62 | - { |
|
63 | - foreach ((array) $kind as $value) { |
|
64 | - if (\in_array($value, [$this->id, $this->text], true)) { |
|
65 | - return true; |
|
66 | - } |
|
67 | - } |
|
58 | + /** |
|
59 | + * @param int|string|array $kind |
|
60 | + */ |
|
61 | + public function is($kind): bool |
|
62 | + { |
|
63 | + foreach ((array) $kind as $value) { |
|
64 | + if (\in_array($value, [$this->id, $this->text], true)) { |
|
65 | + return true; |
|
66 | + } |
|
67 | + } |
|
68 | 68 | |
69 | - return false; |
|
70 | - } |
|
69 | + return false; |
|
70 | + } |
|
71 | 71 | |
72 | - public function isIgnorable(): bool |
|
73 | - { |
|
74 | - return \in_array($this->id, [\T_WHITESPACE, \T_COMMENT, \T_DOC_COMMENT, \T_OPEN_TAG], true); |
|
75 | - } |
|
72 | + public function isIgnorable(): bool |
|
73 | + { |
|
74 | + return \in_array($this->id, [\T_WHITESPACE, \T_COMMENT, \T_DOC_COMMENT, \T_OPEN_TAG], true); |
|
75 | + } |
|
76 | 76 | |
77 | - public function __toString(): string |
|
78 | - { |
|
79 | - return (string) $this->text; |
|
80 | - } |
|
77 | + public function __toString(): string |
|
78 | + { |
|
79 | + return (string) $this->text; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return static[] |
|
84 | - */ |
|
85 | - public static function tokenize(string $code, int $flags = 0): array |
|
86 | - { |
|
87 | - $line = 1; |
|
88 | - $position = 0; |
|
89 | - $tokens = token_get_all($code, $flags); |
|
90 | - foreach ($tokens as $index => $token) { |
|
91 | - if (\is_string($token)) { |
|
92 | - $id = \ord($token); |
|
93 | - $text = $token; |
|
94 | - } else { |
|
95 | - [$id, $text, $line] = $token; |
|
96 | - } |
|
97 | - $tokens[$index] = new static($id, $text, $line, $position); |
|
98 | - $position += \strlen($text); |
|
99 | - } |
|
82 | + /** |
|
83 | + * @return static[] |
|
84 | + */ |
|
85 | + public static function tokenize(string $code, int $flags = 0): array |
|
86 | + { |
|
87 | + $line = 1; |
|
88 | + $position = 0; |
|
89 | + $tokens = token_get_all($code, $flags); |
|
90 | + foreach ($tokens as $index => $token) { |
|
91 | + if (\is_string($token)) { |
|
92 | + $id = \ord($token); |
|
93 | + $text = $token; |
|
94 | + } else { |
|
95 | + [$id, $text, $line] = $token; |
|
96 | + } |
|
97 | + $tokens[$index] = new static($id, $text, $line, $position); |
|
98 | + $position += \strlen($text); |
|
99 | + } |
|
100 | 100 | |
101 | - return $tokens; |
|
102 | - } |
|
101 | + return $tokens; |
|
102 | + } |
|
103 | 103 | } |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if (\PHP_VERSION_ID < 80000) { |
4 | - interface Stringable |
|
5 | - { |
|
6 | - /** |
|
7 | - * @return string |
|
8 | - */ |
|
9 | - public function __toString(); |
|
10 | - } |
|
4 | + interface Stringable |
|
5 | + { |
|
6 | + /** |
|
7 | + * @return string |
|
8 | + */ |
|
9 | + public function __toString(); |
|
10 | + } |
|
11 | 11 | } |
@@ -3,20 +3,20 @@ |
||
3 | 3 | #[Attribute(Attribute::TARGET_CLASS)] |
4 | 4 | final class Attribute |
5 | 5 | { |
6 | - public const TARGET_CLASS = 1; |
|
7 | - public const TARGET_FUNCTION = 2; |
|
8 | - public const TARGET_METHOD = 4; |
|
9 | - public const TARGET_PROPERTY = 8; |
|
10 | - public const TARGET_CLASS_CONSTANT = 16; |
|
11 | - public const TARGET_PARAMETER = 32; |
|
12 | - public const TARGET_ALL = 63; |
|
13 | - public const IS_REPEATABLE = 64; |
|
6 | + public const TARGET_CLASS = 1; |
|
7 | + public const TARGET_FUNCTION = 2; |
|
8 | + public const TARGET_METHOD = 4; |
|
9 | + public const TARGET_PROPERTY = 8; |
|
10 | + public const TARGET_CLASS_CONSTANT = 16; |
|
11 | + public const TARGET_PARAMETER = 32; |
|
12 | + public const TARGET_ALL = 63; |
|
13 | + public const IS_REPEATABLE = 64; |
|
14 | 14 | |
15 | - /** @var int */ |
|
16 | - public $flags; |
|
15 | + /** @var int */ |
|
16 | + public $flags; |
|
17 | 17 | |
18 | - public function __construct(int $flags = self::TARGET_ALL) |
|
19 | - { |
|
20 | - $this->flags = $flags; |
|
21 | - } |
|
18 | + public function __construct(int $flags = self::TARGET_ALL) |
|
19 | + { |
|
20 | + $this->flags = $flags; |
|
21 | + } |
|
22 | 22 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if (\PHP_VERSION_ID < 80000 && \extension_loaded('tokenizer')) { |
4 | - class PhpToken extends Symfony\Polyfill\Php80\PhpToken |
|
5 | - { |
|
6 | - } |
|
4 | + class PhpToken extends Symfony\Polyfill\Php80\PhpToken |
|
5 | + { |
|
6 | + } |
|
7 | 7 | } |