@@ -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 | ) { |
@@ -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 |
@@ -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 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | * @param object|string $argument Class name or instance of object |
39 | 39 | * @param ?ClassLike $classLikeNode AST node for class |
40 | 40 | */ |
41 | - public function __construct(object|string $argument, ?ClassLike $classLikeNode = null) |
|
41 | + public function __construct(object | string $argument, ?ClassLike $classLikeNode = null) |
|
42 | 42 | { |
43 | 43 | $fullClassName = is_object($argument) ? get_class($argument) : ltrim($argument, '\\'); |
44 | 44 | $namespaceParts = explode('\\', $fullClassName); |