Completed
Pull Request — master (#122)
by
unknown
21:01
created
src/ReflectionParameter.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/ReflectionMethod.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.
src/Traits/ReflectionClassLikeTrait.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      *
108 108
      * @var BaseReflectionClass|false|null
109 109
      */
110
-    protected null|BaseReflectionClass|false $parentClass;
110
+    protected null | BaseReflectionClass | false $parentClass;
111 111
 
112 112
     /**
113 113
      * @var ReflectionProperty[]|null
@@ -160,19 +160,19 @@  discard block
 block discarded – undo
160 160
             }
161 161
         }
162 162
 
163
-        $buildString = static function (array $items, $indentLevel = 4) {
163
+        $buildString = static function(array $items, $indentLevel = 4) {
164 164
             if (!count($items)) {
165 165
                 return '';
166 166
             }
167
-            $indent = "\n" . str_repeat(' ', $indentLevel);
167
+            $indent = "\n".str_repeat(' ', $indentLevel);
168 168
 
169
-            return $indent . implode($indent, explode("\n", implode("\n", $items)));
169
+            return $indent.implode($indent, explode("\n", implode("\n", $items)));
170 170
         };
171 171
 
172
-        $buildConstants = static function (array $items, $indentLevel = 4) {
172
+        $buildConstants = static function(array $items, $indentLevel = 4) {
173 173
             $str = '';
174 174
             foreach ($items as $name => $value) {
175
-                $str .= "\n" . str_repeat(' ', $indentLevel);
175
+                $str .= "\n".str_repeat(' ', $indentLevel);
176 176
                 $str .= sprintf(
177 177
                     'Constant [ %s %s ] { %s }',
178 178
                     gettype($value),
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
             ($isObject ? 'Object of class' : 'Class'),
198 198
             $modifiers,
199 199
             $this->getName(),
200
-            false !== $parentClass ? (' extends ' . $parentClass->getName()) : '',
201
-            $interfaceNames ? (' implements ' . implode(', ', $interfaceNames)) : '',
200
+            false !== $parentClass ? (' extends '.$parentClass->getName()) : '',
201
+            $interfaceNames ? (' implements '.implode(', ', $interfaceNames)) : '',
202 202
             $this->getFileName(),
203 203
             $this->getStartLine(),
204 204
             $this->getEndLine(),
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
     ): array {
256 256
         if (!isset($this->constants)) {
257 257
             $this->constants = $this->recursiveCollect(
258
-                function (array &$result, BaseReflectionClass $instance) {
258
+                function(array &$result, BaseReflectionClass $instance) {
259 259
                     $result += $instance->getConstants();
260 260
                 }
261 261
             );
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
      *
329 329
      * @return string|false The doc comment if it exists, otherwise {@see false}
330 330
      */
331
-    public function getDocComment(): string|false
331
+    public function getDocComment(): string | false
332 332
     {
333 333
         $docComment = $this->classLikeNode->getDocComment();
334 334
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
      * @return int|false The ending line number of the user defined class, or
344 344
      *                   {@see false} if unknown.
345 345
      */
346
-    public function getEndLine(): int|false
346
+    public function getEndLine(): int | false
347 347
     {
348 348
         return $this->classLikeNode->getAttribute('endLine');
349 349
     }
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
      * @return string|false The name of the extension which defined the class,
370 370
      *                      or {@see false} for user-defined classes.
371 371
      */
372
-    public function getExtensionName(): string|false
372
+    public function getExtensionName(): string | false
373 373
     {
374 374
         return false;
375 375
     }
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
      *                      If the class is defined in the PHP core or in a PHP extension, {@see false}
384 384
      *                      is returned.
385 385
      */
386
-    public function getFileName(): string|false
386
+    public function getFileName(): string | false
387 387
     {
388 388
         return $this->classLikeNode->getAttribute('fileName');
389 389
     }
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
     {
413 413
         if (!isset($this->interfaceClasses)) {
414 414
             $this->interfaceClasses = $this->recursiveCollect(
415
-                function (array &$result, BaseReflectionClass $instance) {
415
+                function(array &$result, BaseReflectionClass $instance) {
416 416
                     if ($instance->isInterface()) {
417 417
                         $result[$instance->name] = $instance;
418 418
                     }
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
         if (!isset($this->methods)) {
464 464
             $directMethods = ReflectionMethod::collectFromClassNode($this->classLikeNode, $this);
465 465
             $parentMethods = $this->recursiveCollect(
466
-                function (array &$result, ReflectionClass $instance, $isParent) {
466
+                function(array &$result, ReflectionClass $instance, $isParent) {
467 467
                     $reflectionMethods = [];
468 468
                     foreach ($instance->getMethods() as $reflectionMethod) {
469 469
                         if (!$isParent || !$reflectionMethod->isPrivate()) {
@@ -605,9 +605,9 @@  discard block
 block discarded – undo
605 605
      */
606 606
     public function getName(): string
607 607
     {
608
-        $namespaceName = $this->namespaceName ? $this->namespaceName . '\\' : '';
608
+        $namespaceName = $this->namespaceName ? $this->namespaceName.'\\' : '';
609 609
 
610
-        return $namespaceName . $this->getShortName();
610
+        return $namespaceName.$this->getShortName();
611 611
     }
612 612
 
613 613
     /**
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
      * @return ReflectionClass|false A {@see ReflectionClass} or {@see false}
631 631
      *                                   if there's no parent.
632 632
      */
633
-    public function getParentClass(): ReflectionClass|false
633
+    public function getParentClass(): ReflectionClass | false
634 634
     {
635 635
         if (!isset($this->parentClass)) {
636 636
             static $extendsField = 'extends';
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
         if (!isset($this->properties)) {
668 668
             $directProperties = ReflectionProperty::collectFromClassNode($this->classLikeNode, $this->getName());
669 669
             $parentProperties = $this->recursiveCollect(
670
-                function (array &$result, ReflectionClass $instance, $isParent) {
670
+                function(array &$result, ReflectionClass $instance, $isParent) {
671 671
                     $reflectionProperties = [];
672 672
                     foreach ($instance->getProperties() as $reflectionProperty) {
673 673
                         if (!$isParent || !$reflectionProperty->isPrivate()) {
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
      *
731 731
      * @return BaseReflectionClassConstant|false A {@see BaseReflectionClassConstant}.
732 732
      */
733
-    public function getReflectionConstant(string $name): BaseReflectionClassConstant|false
733
+    public function getReflectionConstant(string $name): BaseReflectionClassConstant | false
734 734
     {
735 735
         $classConstants = $this->getReflectionConstants();
736 736
         foreach ($classConstants as $classConstant) {
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
                 $this->getName()
763 763
             );
764 764
             $parentClassConstants = $this->recursiveCollect(
765
-                function (array &$result, ReflectionClass $instance, $isParent) {
765
+                function(array &$result, ReflectionClass $instance, $isParent) {
766 766
                     $reflectionClassConstants = [];
767 767
                     foreach ($instance->getReflectionConstants() as $reflectionClassConstant) {
768 768
                         if (!$isParent || !$reflectionClassConstant->isPrivate()) {
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
      *
800 800
      * @return int|false The starting line number, as an integer.
801 801
      */
802
-    public function getStartLine(): int|false
802
+    public function getStartLine(): int | false
803 803
     {
804 804
         return $this->classLikeNode->getAttribute('startLine');
805 805
     }
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
                         break;
828 828
                     }
829 829
                 }
830
-                $aliases[$adaptation->newName->toString()] = $traitName . '::' . $methodName;
830
+                $aliases[$adaptation->newName->toString()] = $traitName.'::'.$methodName;
831 831
             }
832 832
         }
833 833
 
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
      *
938 938
      * @return bool Returns {@see true} on success or {@see false} on failure.
939 939
      */
940
-    public function implementsInterface(BaseReflectionClass|string $interface): bool
940
+    public function implementsInterface(BaseReflectionClass | string $interface): bool
941 941
     {
942 942
         $allInterfaces = $this->getInterfaces();
943 943
 
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
      *
1112 1112
      * @return bool {@see true} on success or {@see false} on failure.
1113 1113
      */
1114
-    public function isSubclassOf(BaseReflectionClass|string $class): bool
1114
+    public function isSubclassOf(BaseReflectionClass | string $class): bool
1115 1115
     {
1116 1116
         if ($class instanceof ReflectionClass) {
1117 1117
             $className = $class->name;
Please login to merge, or discard this patch.
src/Traits/ReflectionFunctionLikeTrait.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Traits/CanHoldAttributesTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.
src/ReflectionFileNamespace.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.