@@ -38,7 +38,7 @@ |
||
38 | 38 | * |
39 | 39 | * @noinspection PhpMissingParentConstructorInspection |
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); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @noinspection PhpUnusedParameterInspection |
90 | 90 | */ |
91 | 91 | public function __construct( |
92 | - string|array $unusedFunctionName, |
|
92 | + string | array $unusedFunctionName, |
|
93 | 93 | string $parameterName, |
94 | 94 | Param $parameterNode = null, |
95 | 95 | int $parameterIndex = 0, |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | public function __debugInfo(): array |
138 | 138 | { |
139 | 139 | return [ |
140 | - 'name' => (string)$this->parameterNode->var->name, |
|
140 | + 'name' => (string) $this->parameterNode->var->name, |
|
141 | 141 | ]; |
142 | 142 | } |
143 | 143 | |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | /** @noinspection PhpUnhandledExceptionInspection */ |
159 | 159 | $defaultValue = $this->getDefaultValue(); |
160 | 160 | if (is_string($defaultValue) && strlen($defaultValue) > 15) { |
161 | - $defaultValue = substr($defaultValue, 0, 15) . '...'; |
|
161 | + $defaultValue = substr($defaultValue, 0, 15).'...'; |
|
162 | 162 | } |
163 | 163 | /* @see https://3v4l.org/DJOEb for behaviour changes */ |
164 | 164 | if (is_float($defaultValue) && fmod($defaultValue, 1.0) === 0.0) { |
165 | - $defaultValue = (int)$defaultValue; |
|
165 | + $defaultValue = (int) $defaultValue; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | $defaultValue = str_replace('\\\\', '\\', var_export($defaultValue, true)); |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | 'Parameter #%d [ %s %s%s%s$%s%s ]', |
173 | 173 | $this->parameterIndex, |
174 | 174 | $isOptional ? '<optional>' : '<required>', |
175 | - $parameterType ? ReflectionType::convertToDisplayType($parameterType) . ' ' : '', |
|
175 | + $parameterType ? ReflectionType::convertToDisplayType($parameterType).' ' : '', |
|
176 | 176 | $this->isVariadic() ? '...' : '', |
177 | 177 | $this->isPassedByReference() ? '&' : '', |
178 | 178 | $this->getName(), |
179 | - ($isOptional && $hasDefaultValue) ? (' = ' . $defaultValue) : '' |
|
179 | + ($isOptional && $hasDefaultValue) ? (' = '.$defaultValue) : '' |
|
180 | 180 | ); |
181 | 181 | } |
182 | 182 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | /** |
210 | 210 | * {@inheritDoc} |
211 | 211 | */ |
212 | - public function getClass(): BaseReflectionClass|null |
|
212 | + public function getClass(): BaseReflectionClass | null |
|
213 | 213 | { |
214 | 214 | $parameterType = $this->parameterNode->type; |
215 | 215 | if ($parameterType instanceof Name) { |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function getName(): string |
288 | 288 | { |
289 | - return (string)$this->parameterNode->var->name; |
|
289 | + return (string) $this->parameterNode->var->name; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | * @return BaseReflectionType|null Returns a {@see BaseReflectionType} object if a |
306 | 306 | * parameter type is specified, {@see null} otherwise. |
307 | 307 | */ |
308 | - public function getType(): BaseReflectionType|null |
|
308 | + public function getType(): BaseReflectionType | null |
|
309 | 309 | { |
310 | 310 | $parameterType = $this->parameterNode->type; |
311 | 311 | if ($parameterType instanceof NullableType) { |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * |
333 | 333 | * @return ReflectionNamedType|null |
334 | 334 | */ |
335 | - private function resolveReflectionNamedType(Identifier|Name|null $parameterType): ReflectionNamedType|null |
|
335 | + private function resolveReflectionNamedType(Identifier | Name | null $parameterType): ReflectionNamedType | null |
|
336 | 336 | { |
337 | 337 | $isBuiltin = false; |
338 | 338 | $allowsNull = $this->allowsNull(); |
@@ -310,9 +310,7 @@ |
||
310 | 310 | $parameterType = $this->parameterNode->type; |
311 | 311 | if ($parameterType instanceof NullableType) { |
312 | 312 | $parameterType = $parameterType->type; |
313 | - } |
|
314 | - |
|
315 | - elseif ($parameterType instanceof UnionType) { |
|
313 | + } elseif ($parameterType instanceof UnionType) { |
|
316 | 314 | $types = []; |
317 | 315 | foreach ($parameterType->types as $type) { |
318 | 316 | $types[] = $this->resolveReflectionNamedType($type); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | public function __debugInfo(): array |
90 | 90 | { |
91 | 91 | try { |
92 | - $name = $this->aliasName ?? $this->getClassMethodNode()->name->toString(); |
|
92 | + $name = $this->aliasName ?? $this->getClassMethodNode()->name->toString(); |
|
93 | 93 | $class = $this->aliasClass ? $this->aliasClass->getName() : $this->className; |
94 | 94 | } catch (Error) { |
95 | 95 | // If we are here, then we are in the middle of the object creation |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | $paramString = ''; |
130 | 130 | $indentation = str_repeat(' ', 4); |
131 | 131 | foreach ($methodParameters as $methodParameter) { |
132 | - $paramString .= "\n$indentation" . $methodParameter; |
|
132 | + $paramString .= "\n$indentation".$methodParameter; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** @noinspection PhpFormatFunctionParametersMismatchInspection */ |
136 | 136 | return sprintf( |
137 | 137 | "%sMethod [ <user%s%s%s>%s%s%s %s method %s ] {\n @@ %s %d - %d$paramFormat$returnFormat\n}\n", |
138 | - $this->getDocComment() ? $this->getDocComment() . "\n" : '', |
|
138 | + $this->getDocComment() ? $this->getDocComment()."\n" : '', |
|
139 | 139 | $prototype ? ", overwrites $prototypeClass, prototype $prototypeClass" : '', |
140 | 140 | $this->isConstructor() ? ', ctor' : '', |
141 | 141 | $this->isFinal() ? ' final' : '', |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | /** |
232 | 232 | * {@inheritDoc} |
233 | 233 | */ |
234 | - public function getPrototype(): BaseReflectionMethod|ReflectionMethod |
|
234 | + public function getPrototype(): BaseReflectionMethod | ReflectionMethod |
|
235 | 235 | { |
236 | 236 | $parent = $this->getDeclaringClass()->getParentClass(); |
237 | 237 | if (!$parent) { |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | return parent::getClosureThis(); |
81 | 81 | } |
82 | 82 | |
83 | - public function getDocComment(): string|false |
|
83 | + public function getDocComment(): string | false |
|
84 | 84 | { |
85 | 85 | $docComment = $this->functionLikeNode->getDocComment(); |
86 | 86 | |
87 | 87 | return $docComment ? $docComment->getText() : false; |
88 | 88 | } |
89 | 89 | |
90 | - public function getEndLine(): int|false |
|
90 | + public function getEndLine(): int | false |
|
91 | 91 | { |
92 | 92 | return $this->functionLikeNode->getAttribute('endLine'); |
93 | 93 | } |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | return null; |
98 | 98 | } |
99 | 99 | |
100 | - public function getExtensionName(): string|false |
|
100 | + public function getExtensionName(): string | false |
|
101 | 101 | { |
102 | 102 | return false; |
103 | 103 | } |
104 | 104 | |
105 | - public function getFileName(): string|false |
|
105 | + public function getFileName(): string | false |
|
106 | 106 | { |
107 | 107 | return $this->functionLikeNode->getAttribute('fileName'); |
108 | 108 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | if ($this->functionLikeNode instanceof Function_ || $this->functionLikeNode instanceof ClassMethod) { |
124 | 124 | $functionName = $this->functionLikeNode->name->toString(); |
125 | 125 | |
126 | - return $this->namespaceName ? $this->namespaceName . '\\' . $functionName : $functionName; |
|
126 | + return $this->namespaceName ? $this->namespaceName.'\\'.$functionName : $functionName; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** @noinspection PhpMultipleClassDeclarationsInspection */ |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | foreach ($this->functionLikeNode->getParams() as $parameterIndex => $parameterNode) { |
185 | 185 | $reflectionParameter = new ReflectionParameter( |
186 | 186 | $this->getName(), |
187 | - (string)$parameterNode->var->name, |
|
187 | + (string) $parameterNode->var->name, |
|
188 | 188 | $parameterNode, |
189 | 189 | $parameterIndex, |
190 | 190 | $this |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | return parent::getShortName(); |
247 | 247 | } |
248 | 248 | |
249 | - public function getStartLine(): int|false |
|
249 | + public function getStartLine(): int | false |
|
250 | 250 | { |
251 | 251 | return $this->functionLikeNode->name->getAttribute('startLine'); |
252 | 252 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | $this instanceof ReflectionProperty => $this->isPromoted() |
53 | 53 | ? $this->getNode() |
54 | 54 | : $this->getTypeNode(), |
55 | - default => throw new LogicException('Unsupported reflection type: ' . get_class($this)), |
|
55 | + default => throw new LogicException('Unsupported reflection type: '.get_class($this)), |
|
56 | 56 | }; |
57 | 57 | |
58 | 58 | foreach ($node->attrGroups as $attributeGroup) { |
@@ -233,9 +233,7 @@ |
||
233 | 233 | return [$classLevelNode, $classProperty, null]; |
234 | 234 | } |
235 | 235 | } |
236 | - } |
|
237 | - |
|
238 | - else if ($classLevelNode instanceof ClassMethod |
|
236 | + } else if ($classLevelNode instanceof ClassMethod |
|
239 | 237 | && $classLevelNode->name->toString() === '__construct' |
240 | 238 | ) { |
241 | 239 | foreach ($classLevelNode->getParams() as $param) { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return ReflectionClass|bool |
105 | 105 | */ |
106 | - public function getClass(string $className): ReflectionClass|bool |
|
106 | + public function getClass(string $className): ReflectionClass | bool |
|
107 | 107 | { |
108 | 108 | if ($this->hasClass($className)) { |
109 | 109 | return $this->fileClasses[$className]; |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @return string|false The doc comment if it exists, otherwise "false" |
171 | 171 | */ |
172 | - public function getDocComment(): bool|string |
|
172 | + public function getDocComment(): bool | string |
|
173 | 173 | { |
174 | 174 | $docComment = false; |
175 | 175 | $comments = $this->namespaceNode->getAttribute('comments'); |
176 | 176 | |
177 | 177 | if ($comments) { |
178 | - $docComment = (string)$comments[0]; |
|
178 | + $docComment = (string) $comments[0]; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | return $docComment; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return bool|ReflectionFunction |
206 | 206 | */ |
207 | - public function getFunction(string $functionName): bool|ReflectionFunction |
|
207 | + public function getFunction(string $functionName): bool | ReflectionFunction |
|
208 | 208 | { |
209 | 209 | if ($this->hasFunction($functionName)) { |
210 | 210 | return $this->fileFunctions[$functionName]; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { |
329 | 329 | if ($namespaceLevelNode instanceof ClassLike) { |
330 | 330 | $classShortName = $namespaceLevelNode->name->toString(); |
331 | - $className = $namespaceName ? $namespaceName .'\\' . $classShortName : $classShortName; |
|
331 | + $className = $namespaceName ? $namespaceName.'\\'.$classShortName : $classShortName; |
|
332 | 332 | |
333 | 333 | $namespaceLevelNode->setAttribute('fileName', $this->fileName); |
334 | 334 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { |
358 | 358 | if ($namespaceLevelNode instanceof Function_) { |
359 | 359 | $funcShortName = $namespaceLevelNode->name->toString(); |
360 | - $functionName = $namespaceName ? $namespaceName .'\\' . $funcShortName : $funcShortName; |
|
360 | + $functionName = $namespaceName ? $namespaceName.'\\'.$funcShortName : $funcShortName; |
|
361 | 361 | |
362 | 362 | $namespaceLevelNode->setAttribute('fileName', $this->fileName); |
363 | 363 | $functions[$funcShortName] = new ReflectionFunction($functionName, $namespaceLevelNode); |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | if ($namespaceLevelNode instanceof Expression |
398 | 398 | && $namespaceLevelNode->expr instanceof FuncCall |
399 | 399 | && $namespaceLevelNode->expr->name instanceof Name |
400 | - && (string)$namespaceLevelNode->expr->name === 'define' |
|
400 | + && (string) $namespaceLevelNode->expr->name === 'define' |
|
401 | 401 | ) { |
402 | 402 | $functionCallNode = $namespaceLevelNode->expr; |
403 | 403 | $expressionSolver->process($functionCallNode->args[0]->value); |