@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | $isRelative = !$pathScheme && ($path[0] !== '/') && ($path[1] !== ':'); |
52 | 52 | if ($isRelative) { |
53 | - $path = getcwd() . DIRECTORY_SEPARATOR . $path; |
|
53 | + $path = getcwd().DIRECTORY_SEPARATOR.$path; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // resolve path parts (single dot, double dot and double delimiters) |
@@ -29,7 +29,7 @@ |
||
29 | 29 | { |
30 | 30 | public function __construct( |
31 | 31 | private string $attributeName, |
32 | - private ReflectionClass|ReflectionMethod|ReflectionProperty|ReflectionClassConstant|ReflectionFunction|ReflectionParameter $reflector, |
|
32 | + private ReflectionClass | ReflectionMethod | ReflectionProperty | ReflectionClassConstant | ReflectionFunction | ReflectionParameter $reflector, |
|
33 | 33 | private array $arguments, |
34 | 34 | private bool $isRepeated, |
35 | 35 | ) { |
@@ -420,7 +420,7 @@ |
||
420 | 420 | $paramNode |
421 | 421 | ); |
422 | 422 | } |
423 | - } |
|
423 | + } |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | use InternalPropertiesEmulationTrait; |
38 | 38 | use AttributeResolverTrait; |
39 | 39 | |
40 | - private Property|Param $propertyOrPromotedParam; |
|
40 | + private Property | Param $propertyOrPromotedParam; |
|
41 | 41 | |
42 | - private PropertyItem|Param $propertyItemOrPromotedParam; |
|
42 | + private PropertyItem | Param $propertyItemOrPromotedParam; |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Name of the class |
46 | 46 | */ |
47 | 47 | private string $className; |
48 | 48 | |
49 | - private \ReflectionUnionType|\ReflectionNamedType|\ReflectionIntersectionType|null $type = null; |
|
49 | + private \ReflectionUnionType | \ReflectionNamedType | \ReflectionIntersectionType | null $type = null; |
|
50 | 50 | |
51 | 51 | private mixed $defaultValue = null; |
52 | 52 | |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | public function __construct( |
69 | 69 | string $className, |
70 | 70 | string $propertyName, |
71 | - Property|Param $propertyOrPromotedParam = null, |
|
72 | - PropertyItem|Param $propertyItemOrPromotedParam = null |
|
71 | + Property | Param $propertyOrPromotedParam = null, |
|
72 | + PropertyItem | Param $propertyItemOrPromotedParam = null |
|
73 | 73 | ) { |
74 | 74 | $this->className = ltrim($className, '\\'); |
75 | 75 | if (!$propertyOrPromotedParam || !$propertyItemOrPromotedParam) { |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | /** |
109 | 109 | * Returns an AST-node for property item |
110 | 110 | */ |
111 | - public function getNode(): PropertyItem|Param |
|
111 | + public function getNode(): PropertyItem | Param |
|
112 | 112 | { |
113 | 113 | return $this->propertyItemOrPromotedParam; |
114 | 114 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | /** |
117 | 117 | * Returns an AST-node for property type |
118 | 118 | */ |
119 | - public function getTypeNode(): Property|Param |
|
119 | + public function getTypeNode(): Property | Param |
|
120 | 120 | { |
121 | 121 | return $this->propertyOrPromotedParam; |
122 | 122 | } |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | return sprintf( |
155 | 155 | "Property [ %s %s$%s%s ]\n", |
156 | 156 | implode(' ', Reflection::getModifierNames($this->getModifiers())), |
157 | - $propertyType ? ReflectionType::convertToDisplayType($propertyType) . ' ' : '', |
|
157 | + $propertyType ? ReflectionType::convertToDisplayType($propertyType).' ' : '', |
|
158 | 158 | $this->getName(), |
159 | - $hasDefaultValue ? (' = ' . $defaultValue) : '' |
|
159 | + $hasDefaultValue ? (' = '.$defaultValue) : '' |
|
160 | 160 | ); |
161 | 161 | } |
162 | 162 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | /** |
172 | 172 | * @inheritDoc |
173 | 173 | */ |
174 | - public function getDocComment(): string|false |
|
174 | + public function getDocComment(): string | false |
|
175 | 175 | { |
176 | 176 | $docBlock = $this->propertyOrPromotedParam->getDocComment(); |
177 | 177 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * @inheritDoc |
222 | 222 | */ |
223 | - public function getValue(object|null $object = null): mixed |
|
223 | + public function getValue(object | null $object = null): mixed |
|
224 | 224 | { |
225 | 225 | if (!isset($object)) { |
226 | 226 | return $this->getDefaultValue(); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | /** |
236 | 236 | * @inheritDoc |
237 | 237 | */ |
238 | - public function getType(): \ReflectionNamedType|\ReflectionUnionType|\ReflectionIntersectionType|null |
|
238 | + public function getType(): \ReflectionNamedType | \ReflectionUnionType | \ReflectionIntersectionType | null |
|
239 | 239 | { |
240 | 240 | return $this->type; |
241 | 241 | } |
@@ -49,9 +49,9 @@ |
||
49 | 49 | */ |
50 | 50 | public function __toString(): string |
51 | 51 | { |
52 | - $allowsNull = $this->allowsNull && !in_array($this->type,['null', 'mixed'], true); |
|
52 | + $allowsNull = $this->allowsNull && !in_array($this->type, ['null', 'mixed'], true); |
|
53 | 53 | |
54 | - return $allowsNull ? '?' . $this->type : $this->type; |
|
54 | + return $allowsNull ? '?'.$this->type : $this->type; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * Initializes reflection data |
29 | 29 | */ |
30 | - public function __construct(ReflectionNamedType|ReflectionIntersectionType ...$types) |
|
30 | + public function __construct(ReflectionNamedType | ReflectionIntersectionType ...$types) |
|
31 | 31 | { |
32 | 32 | $this->types = $types; |
33 | 33 | } |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function __toString(): string |
54 | 54 | { |
55 | - $stringTypes = array_map(function(ReflectionNamedType|ReflectionIntersectionType $type) { |
|
55 | + $stringTypes = array_map(function(ReflectionNamedType | ReflectionIntersectionType $type) { |
|
56 | 56 | return match (true) { |
57 | 57 | $type instanceof ReflectionNamedType => $type->getName(), |
58 | - $type instanceof ReflectionIntersectionType => '(' . $type . ')', |
|
58 | + $type instanceof ReflectionIntersectionType => '('.$type.')', |
|
59 | 59 | }; |
60 | 60 | }, $this->types); |
61 | 61 |
@@ -504,7 +504,7 @@ |
||
504 | 504 | |
505 | 505 | if (method_exists($this->context, 'getDeclaringClass')) { |
506 | 506 | return $this->context->getDeclaringClass() |
507 | - ->getParentClass() |
|
507 | + ->getParentClass() |
|
508 | 508 | ; |
509 | 509 | } |
510 | 510 | } |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | * Current reflection context for parsing |
50 | 50 | */ |
51 | 51 | private |
52 | - \ReflectionClass|\ReflectionFunction|\ReflectionMethod|\ReflectionClassConstant| |
|
53 | - \ReflectionParameter|\ReflectionAttribute|\ReflectionProperty|ReflectionFileNamespace|null $context; |
|
52 | + \ReflectionClass | \ReflectionFunction | \ReflectionMethod | \ReflectionClassConstant | |
|
53 | + \ReflectionParameter | \ReflectionAttribute | \ReflectionProperty | ReflectionFileNamespace | null $context; |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * Flag if given expression is constant |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $node->name = new Name(ltrim($node->name->toString(), '\\')); |
118 | 118 | } else { |
119 | 119 | // For relative names we would like to add namespace prefix |
120 | - $node->name = new Name($this->resolveScalarMagicConstNamespace() . '\\' . $node->name->toString()); |
|
120 | + $node->name = new Name($this->resolveScalarMagicConstNamespace().'\\'.$node->name->toString()); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | // All long array nodes are pretty-printed by PHP in short format |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | $methodName = $this->getDispatchMethodFor($node); |
164 | 164 | if (!method_exists($this, $methodName)) { |
165 | - throw new ReflectionException("Could not find handler for the " . __CLASS__ . "::{$methodName} method"); |
|
165 | + throw new ReflectionException("Could not find handler for the ".__CLASS__."::{$methodName} method"); |
|
166 | 166 | } |
167 | 167 | $value = $this->$methodName($node); |
168 | 168 | } finally { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | throw new ReflectionException("Could not resolve __METHOD__ without method context"); |
241 | 241 | } |
242 | 242 | |
243 | - return $this->context->getDeclaringClass()->name . '::' . $this->context->getShortName(); |
|
243 | + return $this->context->getDeclaringClass()->name.'::'.$this->context->getShortName(); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $fileNamespace = new ReflectionFileNamespace($fileName, $namespaceName); |
342 | 342 | if ($fileNamespace->hasConstant($constantName)) { |
343 | 343 | $constantValue = $fileNamespace->getConstant($constantName); |
344 | - $constantName = $fileNamespace->getName() . '\\' . $constantName; |
|
344 | + $constantName = $fileNamespace->getName().'\\'.$constantName; |
|
345 | 345 | $isResolved = true; |
346 | 346 | } |
347 | 347 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | if (!$isResolved && defined($constantName)) { |
351 | 351 | $constantValue = constant($constantName); |
352 | 352 | if (!$isFQNConstant) { |
353 | - $constantName = $this->context->getNamespaceName() . '\\' . $constantName; |
|
353 | + $constantName = $this->context->getNamespaceName().'\\'.$constantName; |
|
354 | 354 | } |
355 | 355 | } |
356 | 356 | |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | |
386 | 386 | $this->isConstant = true; |
387 | 387 | $this->isConstExpr = true; |
388 | - $this->constantName = $classToReflect . '::' . $constantName; |
|
388 | + $this->constantName = $classToReflect.'::'.$constantName; |
|
389 | 389 | |
390 | 390 | return $refClass->getConstant($constantName); |
391 | 391 | } |
@@ -405,27 +405,27 @@ discard block |
||
405 | 405 | return $result; |
406 | 406 | } |
407 | 407 | |
408 | - protected function resolveExprBinaryOpPlus(Expr\BinaryOp\Plus $node): int|float|array |
|
408 | + protected function resolveExprBinaryOpPlus(Expr\BinaryOp\Plus $node): int | float | array |
|
409 | 409 | { |
410 | 410 | return $this->resolve($node->left) + $this->resolve($node->right); |
411 | 411 | } |
412 | 412 | |
413 | - protected function resolveExprBinaryOpMinus(Expr\BinaryOp\Minus $node): int|float |
|
413 | + protected function resolveExprBinaryOpMinus(Expr\BinaryOp\Minus $node): int | float |
|
414 | 414 | { |
415 | 415 | return $this->resolve($node->left) - $this->resolve($node->right); |
416 | 416 | } |
417 | 417 | |
418 | - protected function resolveExprBinaryOpMul(Expr\BinaryOp\Mul $node): int|float |
|
418 | + protected function resolveExprBinaryOpMul(Expr\BinaryOp\Mul $node): int | float |
|
419 | 419 | { |
420 | 420 | return $this->resolve($node->left) * $this->resolve($node->right); |
421 | 421 | } |
422 | 422 | |
423 | - protected function resolveExprBinaryOpPow(Expr\BinaryOp\Pow $node): int|float |
|
423 | + protected function resolveExprBinaryOpPow(Expr\BinaryOp\Pow $node): int | float |
|
424 | 424 | { |
425 | 425 | return $this->resolve($node->left) ** $this->resolve($node->right); |
426 | 426 | } |
427 | 427 | |
428 | - protected function resolveExprBinaryOpDiv(Expr\BinaryOp\Div $node): int|float |
|
428 | + protected function resolveExprBinaryOpDiv(Expr\BinaryOp\Div $node): int | float |
|
429 | 429 | { |
430 | 430 | return $this->resolve($node->left) / $this->resolve($node->right); |
431 | 431 | } |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | return !$this->resolve($node->expr); |
446 | 446 | } |
447 | 447 | |
448 | - protected function resolveExprBitwiseNot(Expr\BitwiseNot $node): int|string |
|
448 | + protected function resolveExprBitwiseNot(Expr\BitwiseNot $node): int | string |
|
449 | 449 | { |
450 | 450 | return ~$this->resolve($node->expr); |
451 | 451 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | |
478 | 478 | protected function resolveExprBinaryOpConcat(Expr\BinaryOp\Concat $node): string |
479 | 479 | { |
480 | - return $this->resolve($node->left) . $this->resolve($node->right); |
|
480 | + return $this->resolve($node->left).$this->resolve($node->right); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | protected function resolveExprTernary(Expr\Ternary $node): mixed |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | { |
563 | 563 | $nodeType = $node->getType(); |
564 | 564 | |
565 | - return 'resolve' . str_replace('_', '', $nodeType); |
|
565 | + return 'resolve'.str_replace('_', '', $nodeType); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
@@ -504,7 +504,7 @@ |
||
504 | 504 | |
505 | 505 | if (method_exists($this->context, 'getDeclaringClass')) { |
506 | 506 | return $this->context->getDeclaringClass() |
507 | - ->getParentClass() |
|
507 | + ->getParentClass() |
|
508 | 508 | ; |
509 | 509 | } |
510 | 510 | } |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | * Current reflection context for parsing |
41 | 41 | */ |
42 | 42 | private |
43 | - \ReflectionClass|\ReflectionFunction|\ReflectionMethod|\ReflectionClassConstant| |
|
44 | - \ReflectionParameter|\ReflectionAttribute|\ReflectionProperty|ReflectionFileNamespace|null $context; |
|
43 | + \ReflectionClass | \ReflectionFunction | \ReflectionMethod | \ReflectionClassConstant | |
|
44 | + \ReflectionParameter | \ReflectionAttribute | \ReflectionProperty | ReflectionFileNamespace | null $context; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Whether this type has explicit null value set |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | private array $nodeStack = []; |
60 | 60 | |
61 | - private \ReflectionNamedType|\ReflectionUnionType|\ReflectionIntersectionType|null $type; |
|
61 | + private \ReflectionNamedType | \ReflectionUnionType | \ReflectionIntersectionType | null $type; |
|
62 | 62 | |
63 | 63 | public function __construct($context) |
64 | 64 | { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $this->type = $this->resolve($node); |
77 | 77 | } |
78 | 78 | |
79 | - final public function getType(): \ReflectionNamedType|\ReflectionUnionType|\ReflectionIntersectionType|null |
|
79 | + final public function getType(): \ReflectionNamedType | \ReflectionUnionType | \ReflectionIntersectionType | null |
|
80 | 80 | { |
81 | 81 | return $this->type; |
82 | 82 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | $methodName = $this->getDispatchMethodFor($node); |
97 | 97 | if (!method_exists($this, $methodName)) { |
98 | - throw new ReflectionException("Could not find handler for the " . __CLASS__ . "::{$methodName} method"); |
|
98 | + throw new ReflectionException("Could not find handler for the ".__CLASS__."::{$methodName} method"); |
|
99 | 99 | } |
100 | 100 | $type = $this->$methodName($node); |
101 | 101 | } finally { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | private function resolveUnionType(Node\UnionType $unionType): ReflectionUnionType |
110 | 110 | { |
111 | 111 | $resolvedTypes = array_map( |
112 | - fn(Identifier|IntersectionType|Name $singleType) => $this->resolve($singleType), |
|
112 | + fn(Identifier | IntersectionType | Name $singleType) => $this->resolve($singleType), |
|
113 | 113 | $unionType->types |
114 | 114 | ); |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | private function resolveIntersectionType(Node\IntersectionType $intersectionType): ReflectionIntersectionType |
120 | 120 | { |
121 | 121 | $resolvedTypes = array_map( |
122 | - fn(Identifier|IntersectionType|Name $singleType) => $this->resolve($singleType), |
|
122 | + fn(Identifier | IntersectionType | Name $singleType) => $this->resolve($singleType), |
|
123 | 123 | $intersectionType->types |
124 | 124 | ); |
125 | 125 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | { |
156 | 156 | $nodeType = $node->getType(); |
157 | 157 | |
158 | - return 'resolve' . str_replace('_', '', $nodeType); |
|
158 | + return 'resolve'.str_replace('_', '', $nodeType); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -22,5 +22,5 @@ |
||
22 | 22 | * |
23 | 23 | * @param string $className Name of the class (with or without leading '\' FQCN) |
24 | 24 | */ |
25 | - public function locateClass(string $className): false|string; |
|
25 | + public function locateClass(string $className): false | string; |
|
26 | 26 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | public function getClass(string $className): ReflectionClass |
92 | 92 | { |
93 | 93 | if (!$this->hasClass($className)) { |
94 | - throw new ReflectionException("Could not find the class " . $className . " in the file " . $this->fileName); |
|
94 | + throw new ReflectionException("Could not find the class ".$className." in the file ".$this->fileName); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | return $this->fileClasses[$className]; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function getConstant(string $constantName): mixed |
120 | 120 | { |
121 | 121 | if (!$this->hasConstant($constantName)) { |
122 | - throw new ReflectionException("Could not find the constant " . $constantName . " in the file " . $this->fileName); |
|
122 | + throw new ReflectionException("Could not find the constant ".$constantName." in the file ".$this->fileName); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return $this->fileConstants[$constantName]; |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | /** |
151 | 151 | * Gets doc comments from a namespace node if it exists, otherwise "false" |
152 | 152 | */ |
153 | - public function getDocComment(): string|false |
|
153 | + public function getDocComment(): string | false |
|
154 | 154 | { |
155 | 155 | $docComment = false; |
156 | 156 | $comments = $this->namespaceNode->getAttribute('comments'); |
157 | 157 | |
158 | 158 | if ($comments) { |
159 | - $docComment = (string)$comments[0]; |
|
159 | + $docComment = (string) $comments[0]; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | return $docComment; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | /** |
166 | 166 | * Gets starting line number or false if information is not available |
167 | 167 | */ |
168 | - public function getEndLine(): int|false |
|
168 | + public function getEndLine(): int | false |
|
169 | 169 | { |
170 | 170 | if ($this->namespaceNode->hasAttribute('endLine')) { |
171 | 171 | return $this->namespaceNode->getAttribute('endLine'); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | public function getFunction(string $functionName): ReflectionFunction |
191 | 191 | { |
192 | 192 | if (!$this->hasFunction($functionName)) { |
193 | - throw new ReflectionException("Could not find the function " . $functionName . " in the file " . $this->fileName); |
|
193 | + throw new ReflectionException("Could not find the function ".$functionName." in the file ".$this->fileName); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | return $this->fileFunctions[$functionName]; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | /** |
260 | 260 | * Gets starting line number or false if information is not available |
261 | 261 | */ |
262 | - public function getStartLine(): int|false |
|
262 | + public function getStartLine(): int | false |
|
263 | 263 | { |
264 | 264 | if ($this->namespaceNode->hasAttribute('startLine')) { |
265 | 265 | return $this->namespaceNode->getAttribute('startLine'); |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { |
312 | 312 | if ($namespaceLevelNode instanceof ClassLike) { |
313 | 313 | $classShortName = $namespaceLevelNode->name->toString(); |
314 | - $className = $namespaceName ? $namespaceName .'\\' . $classShortName : $classShortName; |
|
314 | + $className = $namespaceName ? $namespaceName.'\\'.$classShortName : $classShortName; |
|
315 | 315 | |
316 | 316 | $namespaceLevelNode->setAttribute('fileName', $this->fileName); |
317 | 317 | $classes[$className] = new ReflectionClass($className, $namespaceLevelNode); |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { |
336 | 336 | if ($namespaceLevelNode instanceof Function_) { |
337 | 337 | $funcShortName = $namespaceLevelNode->name->toString(); |
338 | - $functionName = $namespaceName ? $namespaceName .'\\' . $funcShortName : $funcShortName; |
|
338 | + $functionName = $namespaceName ? $namespaceName.'\\'.$funcShortName : $funcShortName; |
|
339 | 339 | |
340 | 340 | $namespaceLevelNode->setAttribute('fileName', $this->fileName); |
341 | 341 | $functions[$funcShortName] = new ReflectionFunction($functionName, $namespaceLevelNode); |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | if ($namespaceLevelNode instanceof Expression |
374 | 374 | && $namespaceLevelNode->expr instanceof FuncCall |
375 | 375 | && $namespaceLevelNode->expr->name instanceof Name |
376 | - && (string)$namespaceLevelNode->expr->name === 'define' |
|
376 | + && (string) $namespaceLevelNode->expr->name === 'define' |
|
377 | 377 | ) { |
378 | 378 | try { |
379 | 379 | $functionCallNode = $namespaceLevelNode->expr; |