@@ -93,13 +93,13 @@ |
||
93 | 93 | if ($type instanceof ReflectionNamedType) { |
94 | 94 | $displayType = $type->getName(); |
95 | 95 | } else { |
96 | - $displayType = (string)$type; |
|
96 | + $displayType = (string) $type; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | $displayType = ltrim($displayType, '\\'); |
100 | 100 | |
101 | 101 | if ($type->allowsNull()) { |
102 | - $displayType = '?' . $displayType; |
|
102 | + $displayType = '?'.$displayType; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | return $displayType; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @var Node[] |
45 | 45 | */ |
46 | - private Node|array $topLevelNodes; |
|
46 | + private Node | array $topLevelNodes; |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * ReflectionFile constructor. |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return bool|ReflectionFileNamespace |
67 | 67 | */ |
68 | - public function getFileNamespace(string $namespaceName): ReflectionFileNamespace|bool |
|
68 | + public function getFileNamespace(string $namespaceName): ReflectionFileNamespace | bool |
|
69 | 69 | { |
70 | 70 | if ($this->hasFileNamespace($namespaceName)) { |
71 | 71 | return $this->fileNamespaces[$namespaceName]; |
@@ -523,7 +523,7 @@ |
||
523 | 523 | |
524 | 524 | if (method_exists($this->context, 'getDeclaringClass')) { |
525 | 525 | return $this->context->getDeclaringClass() |
526 | - ->getParentClass(); |
|
526 | + ->getParentClass(); |
|
527 | 527 | } |
528 | 528 | } |
529 | 529 |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | protected function resolveScalarMagicConstMethod(): string |
151 | 151 | { |
152 | 152 | if ($this->context instanceof ReflectionMethod) { |
153 | - $fullName = $this->context->getDeclaringClass()->name . '::' . $this->context->getShortName(); |
|
153 | + $fullName = $this->context->getDeclaringClass()->name.'::'.$this->context->getShortName(); |
|
154 | 154 | |
155 | 155 | return $fullName; |
156 | 156 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $fileNamespace = new ReflectionFileNamespace($fileName, $namespaceName); |
249 | 249 | if ($fileNamespace->hasConstant($constantName)) { |
250 | 250 | $constantValue = $fileNamespace->getConstant($constantName); |
251 | - $constantName = $fileNamespace->getName() . '\\' . $constantName; |
|
251 | + $constantName = $fileNamespace->getName().'\\'.$constantName; |
|
252 | 252 | $isResolved = true; |
253 | 253 | } |
254 | 254 | } |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $reason = 'Unable'; |
282 | 282 | if ($classToReflect instanceof Expr) { |
283 | 283 | $methodName = $this->getDispatchMethodFor($classToReflect); |
284 | - $reason = "Method " . __CLASS__ . "::$methodName() not found trying"; |
|
284 | + $reason = "Method ".__CLASS__."::$methodName() not found trying"; |
|
285 | 285 | } |
286 | 286 | throw new ReflectionException("$reason to resolve class constant."); |
287 | 287 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | } |
299 | 299 | |
300 | 300 | $this->isConstant = true; |
301 | - $this->constantName = $classToReflect . '::' . $constantName; |
|
301 | + $this->constantName = $classToReflect.'::'.$constantName; |
|
302 | 302 | |
303 | 303 | return $refClass->getConstant($constantName); |
304 | 304 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | return $this->resolve($node->left) - $this->resolve($node->right); |
326 | 326 | } |
327 | 327 | |
328 | - protected function resolveExprBinaryOpMul(Expr\BinaryOp\Mul $node): float|int |
|
328 | + protected function resolveExprBinaryOpMul(Expr\BinaryOp\Mul $node): float | int |
|
329 | 329 | { |
330 | 330 | return $this->resolve($node->left) * $this->resolve($node->right); |
331 | 331 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | return $this->resolve($node->left) ** $this->resolve($node->right); |
336 | 336 | } |
337 | 337 | |
338 | - protected function resolveExprBinaryOpDiv(Expr\BinaryOp\Div $node): float|int |
|
338 | + protected function resolveExprBinaryOpDiv(Expr\BinaryOp\Div $node): float | int |
|
339 | 339 | { |
340 | 340 | return $this->resolve($node->left) / $this->resolve($node->right); |
341 | 341 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | return !$this->resolve($node->expr); |
351 | 351 | } |
352 | 352 | |
353 | - protected function resolveExprBitwiseNot(Expr\BitwiseNot $node): int|string |
|
353 | + protected function resolveExprBitwiseNot(Expr\BitwiseNot $node): int | string |
|
354 | 354 | { |
355 | 355 | return ~$this->resolve($node->expr); |
356 | 356 | } |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | |
383 | 383 | protected function resolveExprBinaryOpConcat(Expr\BinaryOp\Concat $node): string |
384 | 384 | { |
385 | - return $this->resolve($node->left) . $this->resolve($node->right); |
|
385 | + return $this->resolve($node->left).$this->resolve($node->right); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | protected function resolveExprTernary(Expr\Ternary $node) |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | { |
468 | 468 | $nodeType = $node->getType(); |
469 | 469 | |
470 | - return 'resolve' . str_replace('_', '', $nodeType); |
|
470 | + return 'resolve'.str_replace('_', '', $nodeType); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | /** |
@@ -24,5 +24,5 @@ |
||
24 | 24 | * |
25 | 25 | * @return string|false Path to the file with given class or false if not found |
26 | 26 | */ |
27 | - public function locateClass(string $className): bool|string; |
|
27 | + public function locateClass(string $className): bool | string; |
|
28 | 28 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * @param ?ClassLike $classLikeNode AST node for class |
36 | 36 | * |
37 | 37 | * @noinspection PhpMissingParentConstructorInspection*/ |
38 | - public function __construct(object|string $argument, ClassLike $classLikeNode = null) |
|
38 | + public function __construct(object | string $argument, ClassLike $classLikeNode = null) |
|
39 | 39 | { |
40 | 40 | $fullClassName = is_object($argument) ? get_class($argument) : ltrim($argument, '\\'); |
41 | 41 | $namespaceParts = explode('\\', $fullClassName); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @noinspection PhpUnusedParameterInspection |
84 | 84 | */ |
85 | 85 | public function __construct( |
86 | - string|array $unusedFunctionName, |
|
86 | + string | array $unusedFunctionName, |
|
87 | 87 | string $parameterName, |
88 | 88 | Param $parameterNode = null, |
89 | 89 | int $parameterIndex = 0, |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | public function __debugInfo(): array |
128 | 128 | { |
129 | 129 | return [ |
130 | - 'name' => (string)$this->parameterNode->var->name, |
|
130 | + 'name' => (string) $this->parameterNode->var->name, |
|
131 | 131 | ]; |
132 | 132 | } |
133 | 133 | |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | /** @noinspection PhpUnhandledExceptionInspection */ |
149 | 149 | $defaultValue = $this->getDefaultValue(); |
150 | 150 | if (is_string($defaultValue) && strlen($defaultValue) > 15) { |
151 | - $defaultValue = substr($defaultValue, 0, 15) . '...'; |
|
151 | + $defaultValue = substr($defaultValue, 0, 15).'...'; |
|
152 | 152 | } |
153 | 153 | /* @see https://3v4l.org/DJOEb for behaviour changes */ |
154 | 154 | if (is_float($defaultValue) && fmod($defaultValue, 1.0) === 0.0) { |
155 | - $defaultValue = (int)$defaultValue; |
|
155 | + $defaultValue = (int) $defaultValue; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | $defaultValue = str_replace('\\\\', '\\', var_export($defaultValue, true)); |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | 'Parameter #%d [ %s %s%s%s$%s%s ]', |
163 | 163 | $this->parameterIndex, |
164 | 164 | $isOptional ? '<optional>' : '<required>', |
165 | - $parameterType ? ReflectionType::convertToDisplayType($parameterType) . ' ' : '', |
|
165 | + $parameterType ? ReflectionType::convertToDisplayType($parameterType).' ' : '', |
|
166 | 166 | $this->isVariadic() ? '...' : '', |
167 | 167 | $this->isPassedByReference() ? '&' : '', |
168 | 168 | $this->getName(), |
169 | - ($isOptional && $hasDefaultValue) ? (' = ' . $defaultValue) : '' |
|
169 | + ($isOptional && $hasDefaultValue) ? (' = '.$defaultValue) : '' |
|
170 | 170 | ); |
171 | 171 | } |
172 | 172 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | /** |
200 | 200 | * {@inheritDoc} |
201 | 201 | */ |
202 | - public function getClass(): BaseReflectionClass|null |
|
202 | + public function getClass(): BaseReflectionClass | null |
|
203 | 203 | { |
204 | 204 | $parameterType = $this->parameterNode->type; |
205 | 205 | if ($parameterType instanceof Name) { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function getName(): string |
278 | 278 | { |
279 | - return (string)$this->parameterNode->var->name; |
|
279 | + return (string) $this->parameterNode->var->name; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | /** |
291 | 291 | * {@inheritDoc} |
292 | 292 | */ |
293 | - public function getType(): \ReflectionType|ReflectionNamedType|null |
|
293 | + public function getType(): \ReflectionType | ReflectionNamedType | null |
|
294 | 294 | { |
295 | 295 | $isBuiltin = false; |
296 | 296 | $parameterType = $this->parameterNode->type; |
@@ -58,7 +58,7 @@ |
||
58 | 58 | * |
59 | 59 | * @return string|false Path to the file with given class or false if not found |
60 | 60 | */ |
61 | - public function locateClass(string $className): bool|string |
|
61 | + public function locateClass(string $className): bool | string |
|
62 | 62 | { |
63 | 63 | $filePath = $this->loader->findFile(ltrim($className, '\\')); |
64 | 64 | if (!empty($filePath)) { |
@@ -36,7 +36,7 @@ |
||
36 | 36 | * |
37 | 37 | * @return string|false Path to the file with given class or false if not found |
38 | 38 | */ |
39 | - public function locateClass(string $className): bool|string |
|
39 | + public function locateClass(string $className): bool | string |
|
40 | 40 | { |
41 | 41 | return call_user_func($this->callable, ltrim($className, '\\')); |
42 | 42 | } |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function getConstants( |
227 | 227 | ?int $filter = ReflectionClassConstant::IS_PUBLIC |
228 | - |ReflectionClassConstant::IS_PROTECTED |
|
229 | - |ReflectionClassConstant::IS_PRIVATE |
|
228 | + |ReflectionClassConstant::IS_PROTECTED |
|
229 | + |ReflectionClassConstant::IS_PRIVATE |
|
230 | 230 | ): array { |
231 | 231 | if (!isset($this->constants)) { |
232 | 232 | $this->constants = $this->recursiveCollect( |
@@ -566,8 +566,8 @@ discard block |
||
566 | 566 | */ |
567 | 567 | public function getReflectionConstants( |
568 | 568 | ?int $filter = ReflectionClassConstant::IS_PUBLIC |
569 | - |ReflectionClassConstant::IS_PROTECTED |
|
570 | - |ReflectionClassConstant::IS_PRIVATE |
|
569 | + |ReflectionClassConstant::IS_PROTECTED |
|
570 | + |ReflectionClassConstant::IS_PRIVATE |
|
571 | 571 | ): array { |
572 | 572 | if (!isset($this->classConstants)) { |
573 | 573 | $directClassConstants = ReflectionClassConstant::collectFromClassNode( |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @var BaseReflectionClass|false|null |
102 | 102 | */ |
103 | - protected null|BaseReflectionClass|false $parentClass; |
|
103 | + protected null | BaseReflectionClass | false $parentClass; |
|
104 | 104 | |
105 | 105 | /** |
106 | 106 | * @var ReflectionProperty[]|null |
@@ -149,19 +149,19 @@ discard block |
||
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
152 | - $buildString = static function (array $items, $indentLevel = 4) { |
|
152 | + $buildString = static function(array $items, $indentLevel = 4) { |
|
153 | 153 | if (!count($items)) { |
154 | 154 | return ''; |
155 | 155 | } |
156 | - $indent = "\n" . str_repeat(' ', $indentLevel); |
|
156 | + $indent = "\n".str_repeat(' ', $indentLevel); |
|
157 | 157 | |
158 | - return $indent . implode($indent, explode("\n", implode("\n", $items))); |
|
158 | + return $indent.implode($indent, explode("\n", implode("\n", $items))); |
|
159 | 159 | }; |
160 | 160 | |
161 | - $buildConstants = static function (array $items, $indentLevel = 4) { |
|
161 | + $buildConstants = static function(array $items, $indentLevel = 4) { |
|
162 | 162 | $str = ''; |
163 | 163 | foreach ($items as $name => $value) { |
164 | - $str .= "\n" . str_repeat(' ', $indentLevel); |
|
164 | + $str .= "\n".str_repeat(' ', $indentLevel); |
|
165 | 165 | $str .= sprintf( |
166 | 166 | 'Constant [ %s %s ] { %s }', |
167 | 167 | gettype($value), |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | ($isObject ? 'Object of class' : 'Class'), |
187 | 187 | $modifiers, |
188 | 188 | $this->getName(), |
189 | - false !== $parentClass ? (' extends ' . $parentClass->getName()) : '', |
|
190 | - $interfaceNames ? (' implements ' . implode(', ', $interfaceNames)) : '', |
|
189 | + false !== $parentClass ? (' extends '.$parentClass->getName()) : '', |
|
190 | + $interfaceNames ? (' implements '.implode(', ', $interfaceNames)) : '', |
|
191 | 191 | $this->getFileName(), |
192 | 192 | $this->getStartLine(), |
193 | 193 | $this->getEndLine(), |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | ): array { |
231 | 231 | if (!isset($this->constants)) { |
232 | 232 | $this->constants = $this->recursiveCollect( |
233 | - function (array &$result, BaseReflectionClass $instance) { |
|
233 | + function(array &$result, BaseReflectionClass $instance) { |
|
234 | 234 | $result += $instance->getConstants(); |
235 | 235 | } |
236 | 236 | ); |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | /** |
294 | 294 | * {@inheritDoc} |
295 | 295 | */ |
296 | - public function getDocComment(): string|false |
|
296 | + public function getDocComment(): string | false |
|
297 | 297 | { |
298 | 298 | $docComment = $this->classLikeNode->getDocComment(); |
299 | 299 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | /** |
304 | 304 | * {@inheritDoc} |
305 | 305 | */ |
306 | - public function getEndLine(): int|false |
|
306 | + public function getEndLine(): int | false |
|
307 | 307 | { |
308 | 308 | return $this->classLikeNode->getAttribute('endLine'); |
309 | 309 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | /** |
325 | 325 | * {@inheritDoc} |
326 | 326 | */ |
327 | - public function getExtensionName(): string|false |
|
327 | + public function getExtensionName(): string | false |
|
328 | 328 | { |
329 | 329 | return false; |
330 | 330 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | /** |
333 | 333 | * {@inheritDoc} |
334 | 334 | */ |
335 | - public function getFileName(): string|false |
|
335 | + public function getFileName(): string | false |
|
336 | 336 | { |
337 | 337 | return $this->classLikeNode->getAttribute('fileName'); |
338 | 338 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | { |
353 | 353 | if (!isset($this->interfaceClasses)) { |
354 | 354 | $this->interfaceClasses = $this->recursiveCollect( |
355 | - function (array &$result, BaseReflectionClass $instance) { |
|
355 | + function(array &$result, BaseReflectionClass $instance) { |
|
356 | 356 | if ($instance->isInterface()) { |
357 | 357 | $result[$instance->name] = $instance; |
358 | 358 | } |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | if (!isset($this->methods)) { |
396 | 396 | $directMethods = ReflectionMethod::collectFromClassNode($this->classLikeNode, $this); |
397 | 397 | $parentMethods = $this->recursiveCollect( |
398 | - function (array &$result, BaseReflectionClass $instance, $isParent) { |
|
398 | + function(array &$result, BaseReflectionClass $instance, $isParent) { |
|
399 | 399 | $reflectionMethods = []; |
400 | 400 | foreach ($instance->getMethods() as $reflectionMethod) { |
401 | 401 | if (!$isParent || !$reflectionMethod->isPrivate()) { |
@@ -439,9 +439,9 @@ discard block |
||
439 | 439 | */ |
440 | 440 | public function getName(): string |
441 | 441 | { |
442 | - $namespaceName = $this->namespaceName ? $this->namespaceName . '\\' : ''; |
|
442 | + $namespaceName = $this->namespaceName ? $this->namespaceName.'\\' : ''; |
|
443 | 443 | |
444 | - return $namespaceName . $this->getShortName(); |
|
444 | + return $namespaceName.$this->getShortName(); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | /** |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @return ReflectionClass|false A {@see ReflectionClass} or {@see false} |
461 | 461 | * if there's no parent. |
462 | 462 | */ |
463 | - public function getParentClass(): BaseReflectionClass|false |
|
463 | + public function getParentClass(): BaseReflectionClass | false |
|
464 | 464 | { |
465 | 465 | if (!isset($this->parentClass)) { |
466 | 466 | static $extendsField = 'extends'; |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | if (!isset($this->properties)) { |
487 | 487 | $directProperties = ReflectionProperty::collectFromClassNode($this->classLikeNode, $this->getName()); |
488 | 488 | $parentProperties = $this->recursiveCollect( |
489 | - function (array &$result, BaseReflectionClass $instance, $isParent) { |
|
489 | + function(array &$result, BaseReflectionClass $instance, $isParent) { |
|
490 | 490 | $reflectionProperties = []; |
491 | 491 | foreach ($instance->getProperties() as $reflectionProperty) { |
492 | 492 | if (!$isParent || !$reflectionProperty->isPrivate()) { |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | * |
550 | 550 | * @return ReflectionClassConstant|false A {@see ReflectionClassConstant}. |
551 | 551 | */ |
552 | - public function getReflectionConstant(string $name): BaseReflectionClassConstant|false |
|
552 | + public function getReflectionConstant(string $name): BaseReflectionClassConstant | false |
|
553 | 553 | { |
554 | 554 | $classConstants = $this->getReflectionConstants(); |
555 | 555 | foreach ($classConstants as $classConstant) { |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | $this->getName() |
576 | 576 | ); |
577 | 577 | $parentClassConstants = $this->recursiveCollect( |
578 | - function (array &$result, BaseReflectionClass $instance, $isParent) { |
|
578 | + function(array &$result, BaseReflectionClass $instance, $isParent) { |
|
579 | 579 | $reflectionClassConstants = []; |
580 | 580 | foreach ($instance->getReflectionConstants() as $reflectionClassConstant) { |
581 | 581 | if (!$isParent || !$reflectionClassConstant->isPrivate()) { |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | /** |
605 | 605 | * {@inheritDoc} |
606 | 606 | */ |
607 | - public function getStartLine(): int|false |
|
607 | + public function getStartLine(): int | false |
|
608 | 608 | { |
609 | 609 | return $this->classLikeNode->getAttribute('startLine'); |
610 | 610 | } |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | break; |
627 | 627 | } |
628 | 628 | } |
629 | - $aliases[$adaptation->newName] = $traitName . '::' . $methodName; |
|
629 | + $aliases[$adaptation->newName] = $traitName.'::'.$methodName; |
|
630 | 630 | } |
631 | 631 | } |
632 | 632 | |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | * |
709 | 709 | * @return bool Returns {@see true} on success or {@see false} on failure. |
710 | 710 | */ |
711 | - public function implementsInterface(BaseReflectionClass|string $interface): bool |
|
711 | + public function implementsInterface(BaseReflectionClass | string $interface): bool |
|
712 | 712 | { |
713 | 713 | $allInterfaces = $this->getInterfaces(); |
714 | 714 | |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | * |
841 | 841 | * @return bool {@see true} on success or {@see false} on failure. |
842 | 842 | */ |
843 | - public function isSubclassOf(BaseReflectionClass|string $class): bool |
|
843 | + public function isSubclassOf(BaseReflectionClass | string $class): bool |
|
844 | 844 | { |
845 | 845 | if ($class instanceof ReflectionClass) { |
846 | 846 | $className = $class->name; |