@@ -29,7 +29,7 @@ |
||
29 | 29 | * @param string|array $somePath Path without normalization or array of paths |
30 | 30 | * @param bool $shouldCheckExistence Flag for checking existence of resolved filename |
31 | 31 | * |
32 | - * @return array|bool|string |
|
32 | + * @return string |
|
33 | 33 | */ |
34 | 34 | public static function realpath($somePath, $shouldCheckExistence = false) |
35 | 35 | { |
@@ -41,6 +41,8 @@ discard block |
||
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Initializes reflection data |
44 | + * @param null|boolean $allowsNull |
|
45 | + * @param boolean $isBuiltin |
|
44 | 46 | */ |
45 | 47 | public function __construct($type, $allowsNull, $isBuiltin) |
46 | 48 | { |
@@ -78,7 +80,7 @@ discard block |
||
78 | 80 | * |
79 | 81 | * @see https://3v4l.org/nZFiT |
80 | 82 | * |
81 | - * @param BaseReflectionType $type Type to display |
|
83 | + * @param ReflectionType $type Type to display |
|
82 | 84 | * |
83 | 85 | * @return string |
84 | 86 | */ |
@@ -87,7 +87,7 @@ |
||
87 | 87 | if ($type instanceof ReflectionNamedType) { |
88 | 88 | $displayType = $type->getName(); |
89 | 89 | } else { |
90 | - $displayType = (string)$type; |
|
90 | + $displayType = (string) $type; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | $displayType = ltrim($displayType, '\\'); |
@@ -108,12 +108,12 @@ |
||
108 | 108 | $paramString = ''; |
109 | 109 | $indentation = str_repeat(' ', 4); |
110 | 110 | foreach ($methodParameters as $methodParameter) { |
111 | - $paramString .= "\n{$indentation}" . $methodParameter; |
|
111 | + $paramString .= "\n{$indentation}".$methodParameter; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return sprintf( |
115 | 115 | "%sMethod [ <user%s%s%s>%s%s%s %s method %s ] {\n @@ %s %d - %d{$paramFormat}{$returnFormat}\n}\n", |
116 | - $this->getDocComment() ? $this->getDocComment() . "\n" : '', |
|
116 | + $this->getDocComment() ? $this->getDocComment()."\n" : '', |
|
117 | 117 | $prototype ? ", overwrites {$prototypeClass}, prototype {$prototypeClass}" : '', |
118 | 118 | $this->isConstructor() ? ', ctor' : '', |
119 | 119 | $this->isDestructor() ? ', dtor' : '', |
@@ -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 | } |
@@ -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 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $fileNamespace = new ReflectionFileNamespace($fileName, $namespaceName); |
242 | 242 | if ($fileNamespace->hasConstant($constantName)) { |
243 | 243 | $constantValue = $fileNamespace->getConstant($constantName); |
244 | - $constantName = $fileNamespace->getName() . '\\' . $constantName; |
|
244 | + $constantName = $fileNamespace->getName().'\\'.$constantName; |
|
245 | 245 | $isResolved = true; |
246 | 246 | } |
247 | 247 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $reason = 'Unable'; |
268 | 268 | if ($classToReflect instanceof Expr) { |
269 | 269 | $methodName = $this->getDispatchMethodFor($classToReflect); |
270 | - $reason = "Method " . __CLASS__ . "::{$methodName}() not found trying"; |
|
270 | + $reason = "Method ".__CLASS__."::{$methodName}() not found trying"; |
|
271 | 271 | } |
272 | 272 | throw new ReflectionException("$reason to resolve class constant."); |
273 | 273 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | } |
285 | 285 | |
286 | 286 | $this->isConstant = true; |
287 | - $this->constantName = $classToReflect . '::' . $constantName; |
|
287 | + $this->constantName = $classToReflect.'::'.$constantName; |
|
288 | 288 | |
289 | 289 | return $refClass->getConstant($constantName); |
290 | 290 | } |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | protected function resolveExprBinaryOpConcat(Expr\BinaryOp\Concat $node): string |
370 | 370 | { |
371 | - return $this->resolve($node->left) . $this->resolve($node->right); |
|
371 | + return $this->resolve($node->left).$this->resolve($node->right); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | protected function resolveExprTernary(Expr\Ternary $node) |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | { |
454 | 454 | $nodeType = $node->getType(); |
455 | 455 | |
456 | - return 'resolve' . str_replace('_', '', $nodeType); |
|
456 | + return 'resolve'.str_replace('_', '', $nodeType); |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | /** |
@@ -146,19 +146,19 @@ discard block |
||
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | - $buildString = static function (array $items, $indentLevel = 4) { |
|
149 | + $buildString = static function(array $items, $indentLevel = 4) { |
|
150 | 150 | if (!count($items)) { |
151 | 151 | return ''; |
152 | 152 | } |
153 | - $indent = "\n" . str_repeat(' ', $indentLevel); |
|
153 | + $indent = "\n".str_repeat(' ', $indentLevel); |
|
154 | 154 | |
155 | - return $indent . implode($indent, explode("\n", implode("\n", $items))); |
|
155 | + return $indent.implode($indent, explode("\n", implode("\n", $items))); |
|
156 | 156 | }; |
157 | 157 | |
158 | - $buildConstants = static function (array $items, $indentLevel = 4) { |
|
158 | + $buildConstants = static function(array $items, $indentLevel = 4) { |
|
159 | 159 | $str = ''; |
160 | 160 | foreach ($items as $name => $value) { |
161 | - $str .= "\n" . str_repeat(' ', $indentLevel); |
|
161 | + $str .= "\n".str_repeat(' ', $indentLevel); |
|
162 | 162 | $str .= sprintf( |
163 | 163 | 'Constant [ %s %s ] { %s }', |
164 | 164 | gettype($value), |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | ($isObject ? 'Object of class' : 'Class'), |
184 | 184 | $modifiers, |
185 | 185 | $this->getName(), |
186 | - false !== $parentClass ? (' extends ' . $parentClass->getName()) : '', |
|
187 | - $interfaceNames ? (' implements ' . implode(', ', $interfaceNames)) : '', |
|
186 | + false !== $parentClass ? (' extends '.$parentClass->getName()) : '', |
|
187 | + $interfaceNames ? (' implements '.implode(', ', $interfaceNames)) : '', |
|
188 | 188 | $this->getFileName(), |
189 | 189 | $this->getStartLine(), |
190 | 190 | $this->getEndLine(), |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | { |
226 | 226 | if (!isset($this->constants)) { |
227 | 227 | $this->constants = $this->recursiveCollect( |
228 | - function (array &$result, \ReflectionClass $instance) { |
|
228 | + function(array &$result, \ReflectionClass $instance) { |
|
229 | 229 | $result += $instance->getConstants(); |
230 | 230 | } |
231 | 231 | ); |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | { |
332 | 332 | if (!isset($this->interfaceClasses)) { |
333 | 333 | $this->interfaceClasses = $this->recursiveCollect( |
334 | - function (array &$result, \ReflectionClass $instance) { |
|
334 | + function(array &$result, \ReflectionClass $instance) { |
|
335 | 335 | if ($instance->isInterface()) { |
336 | 336 | $result[$instance->name] = $instance; |
337 | 337 | } |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | if (!isset($this->methods)) { |
372 | 372 | $directMethods = ReflectionMethod::collectFromClassNode($this->classLikeNode, $this); |
373 | 373 | $parentMethods = $this->recursiveCollect( |
374 | - function (array &$result, \ReflectionClass $instance, $isParent) { |
|
374 | + function(array &$result, \ReflectionClass $instance, $isParent) { |
|
375 | 375 | $reflectionMethods = []; |
376 | 376 | foreach ($instance->getMethods() as $reflectionMethod) { |
377 | 377 | if (!$isParent || !$reflectionMethod->isPrivate()) { |
@@ -442,9 +442,9 @@ discard block |
||
442 | 442 | */ |
443 | 443 | public function getName() |
444 | 444 | { |
445 | - $namespaceName = $this->namespaceName ? $this->namespaceName . '\\' : ''; |
|
445 | + $namespaceName = $this->namespaceName ? $this->namespaceName.'\\' : ''; |
|
446 | 446 | |
447 | - return $namespaceName . $this->getShortName(); |
|
447 | + return $namespaceName.$this->getShortName(); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | /** |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | if (!isset($this->properties)) { |
490 | 490 | $directProperties = ReflectionProperty::collectFromClassNode($this->classLikeNode, $this->getName()); |
491 | 491 | $parentProperties = $this->recursiveCollect( |
492 | - function (array &$result, \ReflectionClass $instance, $isParent) { |
|
492 | + function(array &$result, \ReflectionClass $instance, $isParent) { |
|
493 | 493 | $reflectionProperties = []; |
494 | 494 | foreach ($instance->getProperties() as $reflectionProperty) { |
495 | 495 | if (!$isParent || !$reflectionProperty->isPrivate()) { |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | $this->getName() |
562 | 562 | ); |
563 | 563 | $parentClassConstants = $this->recursiveCollect( |
564 | - function (array &$result, \ReflectionClass $instance, $isParent) { |
|
564 | + function(array &$result, \ReflectionClass $instance, $isParent) { |
|
565 | 565 | $reflectionClassConstants = []; |
566 | 566 | foreach ($instance->getReflectionConstants() as $reflectionClassConstant) { |
567 | 567 | if (!$isParent || !$reflectionClassConstant->isPrivate()) { |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | break; |
615 | 615 | } |
616 | 616 | } |
617 | - $aliases[$adaptation->newName] = $traitName . '::' . $methodName; |
|
617 | + $aliases[$adaptation->newName] = $traitName.'::'.$methodName; |
|
618 | 618 | } |
619 | 619 | } |
620 | 620 |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | public function __debugInfo(): array |
124 | 124 | { |
125 | 125 | return [ |
126 | - 'name' => (string)$this->parameterNode->var->name, |
|
126 | + 'name' => (string) $this->parameterNode->var->name, |
|
127 | 127 | ]; |
128 | 128 | } |
129 | 129 | |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | if ($hasDefaultValue) { |
142 | 142 | $defaultValue = $this->getDefaultValue(); |
143 | 143 | if (is_string($defaultValue) && strlen($defaultValue) > 15) { |
144 | - $defaultValue = substr($defaultValue, 0, 15) . '...'; |
|
144 | + $defaultValue = substr($defaultValue, 0, 15).'...'; |
|
145 | 145 | } |
146 | 146 | /* @see https://3v4l.org/DJOEb for behaviour changes */ |
147 | 147 | if (is_float($defaultValue) && fmod($defaultValue, 1.0) === 0.0) { |
148 | - $defaultValue = (int)$defaultValue; |
|
148 | + $defaultValue = (int) $defaultValue; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | $defaultValue = str_replace('\\\\', '\\', var_export($defaultValue, true)); |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | 'Parameter #%d [ %s %s%s%s$%s%s ]', |
156 | 156 | $this->parameterIndex, |
157 | 157 | $isOptional ? '<optional>' : '<required>', |
158 | - $parameterType ? ReflectionType::convertToDisplayType($parameterType) . ' ' : '', |
|
158 | + $parameterType ? ReflectionType::convertToDisplayType($parameterType).' ' : '', |
|
159 | 159 | $this->isVariadic() ? '...' : '', |
160 | 160 | $this->isPassedByReference() ? '&' : '', |
161 | 161 | $this->getName(), |
162 | - ($isOptional && $hasDefaultValue) ? (' = ' . $defaultValue) : '' |
|
162 | + ($isOptional && $hasDefaultValue) ? (' = '.$defaultValue) : '' |
|
163 | 163 | ); |
164 | 164 | } |
165 | 165 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | */ |
269 | 269 | public function getName() |
270 | 270 | { |
271 | - return (string)$this->parameterNode->var->name; |
|
271 | + return (string) $this->parameterNode->var->name; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -117,14 +117,14 @@ |
||
117 | 117 | |
118 | 118 | return sprintf( |
119 | 119 | $reflectionFormat, |
120 | - $this->getDocComment() ? $this->getDocComment() . "\n" : '', |
|
120 | + $this->getDocComment() ? $this->getDocComment()."\n" : '', |
|
121 | 121 | $this->getName(), |
122 | 122 | $this->getFileName(), |
123 | 123 | $this->getStartLine(), |
124 | 124 | $this->getEndLine(), |
125 | 125 | count($this->getParameters()), |
126 | - array_reduce($this->getParameters(), static function ($str, ReflectionParameter $param) { |
|
127 | - return $str . "\n " . $param; |
|
126 | + array_reduce($this->getParameters(), static function($str, ReflectionParameter $param) { |
|
127 | + return $str."\n ".$param; |
|
128 | 128 | }, '') |
129 | 129 | ); |
130 | 130 | } |