@@ -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 | } |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * Current reflection context for parsing |
51 | 51 | */ |
52 | 52 | private |
53 | - \ReflectionClass|\ReflectionFunction|\ReflectionMethod|\ReflectionClassConstant| |
|
54 | - \ReflectionParameter|\ReflectionAttribute|\ReflectionProperty|ReflectionFileNamespace|null $context; |
|
53 | + \ReflectionClass | \ReflectionFunction | \ReflectionMethod | \ReflectionClassConstant | |
|
54 | + \ReflectionParameter | \ReflectionAttribute | \ReflectionProperty | ReflectionFileNamespace | null $context; |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Flag if given expression is constant |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $node->name = new Name(ltrim($constantNodeName->toString(), '\\')); |
124 | 124 | } else { |
125 | 125 | // For relative names we would like to add namespace prefix |
126 | - $node->name = new Name($this->resolveScalarMagicConstNamespace() . '\\' . $constantNodeName->toString()); |
|
126 | + $node->name = new Name($this->resolveScalarMagicConstNamespace().'\\'.$constantNodeName->toString()); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | // All long array nodes are pretty-printed by PHP in short format |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | $methodName = $this->getDispatchMethodFor($node); |
170 | 170 | if (!method_exists($this, $methodName)) { |
171 | - throw new ReflectionException("Could not find handler for the " . __CLASS__ . "::{$methodName} method"); |
|
171 | + throw new ReflectionException("Could not find handler for the ".__CLASS__."::{$methodName} method"); |
|
172 | 172 | } |
173 | 173 | $value = $this->$methodName($node); |
174 | 174 | } finally { |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | throw new ReflectionException("Could not resolve __METHOD__ without method context"); |
256 | 256 | } |
257 | 257 | |
258 | - return $this->context->getDeclaringClass()->name . '::' . $this->context->getShortName(); |
|
258 | + return $this->context->getDeclaringClass()->name.'::'.$this->context->getShortName(); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $fileNamespace = new ReflectionFileNamespace($fileName, $namespaceName); |
362 | 362 | if ($fileNamespace->hasConstant($constantName)) { |
363 | 363 | $constantValue = $fileNamespace->getConstant($constantName); |
364 | - $constantName = $fileNamespace->getName() . '\\' . $constantName; |
|
364 | + $constantName = $fileNamespace->getName().'\\'.$constantName; |
|
365 | 365 | $isResolved = true; |
366 | 366 | } |
367 | 367 | } |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | if (!$isResolved && defined($constantName)) { |
371 | 371 | $constantValue = constant($constantName); |
372 | 372 | if (!$isFQNConstant) { |
373 | - $constantName = $this->context->getNamespaceName() . '\\' . $constantName; |
|
373 | + $constantName = $this->context->getNamespaceName().'\\'.$constantName; |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | |
417 | 417 | $this->isConstant = true; |
418 | 418 | $this->isConstExpr = true; |
419 | - $this->constantName = $classToReflectNodeName . '::' . $constantName; |
|
419 | + $this->constantName = $classToReflectNodeName.'::'.$constantName; |
|
420 | 420 | |
421 | 421 | return $refClass->getConstant($constantName); |
422 | 422 | } |
@@ -436,27 +436,27 @@ discard block |
||
436 | 436 | return $result; |
437 | 437 | } |
438 | 438 | |
439 | - protected function resolveExprBinaryOpPlus(Expr\BinaryOp\Plus $node): int|float|array |
|
439 | + protected function resolveExprBinaryOpPlus(Expr\BinaryOp\Plus $node): int | float | array |
|
440 | 440 | { |
441 | 441 | return $this->resolve($node->left) + $this->resolve($node->right); |
442 | 442 | } |
443 | 443 | |
444 | - protected function resolveExprBinaryOpMinus(Expr\BinaryOp\Minus $node): int|float |
|
444 | + protected function resolveExprBinaryOpMinus(Expr\BinaryOp\Minus $node): int | float |
|
445 | 445 | { |
446 | 446 | return $this->resolve($node->left) - $this->resolve($node->right); |
447 | 447 | } |
448 | 448 | |
449 | - protected function resolveExprBinaryOpMul(Expr\BinaryOp\Mul $node): int|float |
|
449 | + protected function resolveExprBinaryOpMul(Expr\BinaryOp\Mul $node): int | float |
|
450 | 450 | { |
451 | 451 | return $this->resolve($node->left) * $this->resolve($node->right); |
452 | 452 | } |
453 | 453 | |
454 | - protected function resolveExprBinaryOpPow(Expr\BinaryOp\Pow $node): int|float |
|
454 | + protected function resolveExprBinaryOpPow(Expr\BinaryOp\Pow $node): int | float |
|
455 | 455 | { |
456 | 456 | return $this->resolve($node->left) ** $this->resolve($node->right); |
457 | 457 | } |
458 | 458 | |
459 | - protected function resolveExprBinaryOpDiv(Expr\BinaryOp\Div $node): int|float |
|
459 | + protected function resolveExprBinaryOpDiv(Expr\BinaryOp\Div $node): int | float |
|
460 | 460 | { |
461 | 461 | return $this->resolve($node->left) / $this->resolve($node->right); |
462 | 462 | } |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | return !$this->resolve($node->expr); |
477 | 477 | } |
478 | 478 | |
479 | - protected function resolveExprBitwiseNot(Expr\BitwiseNot $node): int|string |
|
479 | + protected function resolveExprBitwiseNot(Expr\BitwiseNot $node): int | string |
|
480 | 480 | { |
481 | 481 | return ~$this->resolve($node->expr); |
482 | 482 | } |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | |
509 | 509 | protected function resolveExprBinaryOpConcat(Expr\BinaryOp\Concat $node): string |
510 | 510 | { |
511 | - return $this->resolve($node->left) . $this->resolve($node->right); |
|
511 | + return $this->resolve($node->left).$this->resolve($node->right); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | protected function resolveExprTernary(Expr\Ternary $node): mixed |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | { |
594 | 594 | $nodeType = $node->getType(); |
595 | 595 | |
596 | - return 'resolve' . str_replace('_', '', $nodeType); |
|
596 | + return 'resolve'.str_replace('_', '', $nodeType); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | /** |
@@ -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; |
@@ -113,20 +113,20 @@ discard block |
||
113 | 113 | |
114 | 114 | $fileString = ''; |
115 | 115 | if ($this->getFileName()) { |
116 | - $fileString .= "\n @@ " . $this->getFileName(); |
|
117 | - $fileString .= ' ' . $this->getStartLine(); |
|
118 | - $fileString .= ' - ' . $this->getEndLine(); |
|
116 | + $fileString .= "\n @@ ".$this->getFileName(); |
|
117 | + $fileString .= ' '.$this->getStartLine(); |
|
118 | + $fileString .= ' - '.$this->getEndLine(); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | $paramString = ''; |
122 | 122 | $indentation = str_repeat(' ', 4); |
123 | 123 | foreach ($methodParameters as $methodParameter) { |
124 | - $paramString .= "\n{$indentation}" . $methodParameter; |
|
124 | + $paramString .= "\n{$indentation}".$methodParameter; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | return sprintf( |
128 | 128 | "%sMethod [ <%s%s%s>%s%s%s %s method %s ] {%s{$paramFormat}{$returnFormat}\n}\n", |
129 | - $this->getDocComment() ? $this->getDocComment() . "\n" : '', |
|
129 | + $this->getDocComment() ? $this->getDocComment()."\n" : '', |
|
130 | 130 | $this->isInternal() ? 'internal' : 'user', |
131 | 131 | $protoString, |
132 | 132 | $this->isConstructor() ? ', ctor' : '', |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | - throw new ReflectionException("Method " . $this->getDeclaringClass()->getName() . "::" . $methodName . "() does not have prototype"); |
|
215 | + throw new ReflectionException("Method ".$this->getDeclaringClass()->getName()."::".$methodName."() does not have prototype"); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | public function hasPrototype(): bool |