Completed
Push — master ( e7e619...fe2b2b )
by Alexander
20:08 queued 20:05
created
src/ReflectionClass.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Traits/ReflectionClassLikeTrait.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     /**
87 87
      * Parent class, or false if not present, null if uninitialized yet
88 88
      */
89
-    protected null|\ReflectionClass|false $parentClass;
89
+    protected null | \ReflectionClass | false $parentClass;
90 90
 
91 91
     /**
92 92
      * @var ReflectionProperty[]
@@ -135,19 +135,19 @@  discard block
 block discarded – undo
135 135
             }
136 136
         }
137 137
 
138
-        $buildString = static function (array $items, $indentLevel = 4) {
138
+        $buildString = static function(array $items, $indentLevel = 4) {
139 139
             if (!count($items)) {
140 140
                 return '';
141 141
             }
142
-            $indent = "\n" . str_repeat(' ', $indentLevel);
142
+            $indent = "\n".str_repeat(' ', $indentLevel);
143 143
 
144
-            return $indent . implode($indent, explode("\n", implode("\n", $items)));
144
+            return $indent.implode($indent, explode("\n", implode("\n", $items)));
145 145
         };
146 146
 
147
-        $buildConstants = static function (array $items, $indentLevel = 4) {
147
+        $buildConstants = static function(array $items, $indentLevel = 4) {
148 148
             $str = '';
149 149
             foreach ($items as $name => $value) {
150
-                $str .= "\n" . str_repeat(' ', $indentLevel);
150
+                $str .= "\n".str_repeat(' ', $indentLevel);
151 151
                 $str .= sprintf(
152 152
                     'Constant [ %s %s ] { %s }',
153 153
                     gettype($value),
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
 
170 170
         $string = sprintf(
171 171
             $format,
172
-            $this->getDocComment() ? $this->getDocComment() . "\n" : '',
172
+            $this->getDocComment() ? $this->getDocComment()."\n" : '',
173 173
             ($isObject ? 'Object of class' : 'Class'),
174 174
             $modifiers,
175 175
             $this->getName(),
176
-            false !== $parentClass ? (' extends ' . $parentClass->getName()) : '',
177
-            $interfaceNames ? (' implements ' . implode(', ', $interfaceNames)) : '',
176
+            false !== $parentClass ? (' extends '.$parentClass->getName()) : '',
177
+            $interfaceNames ? (' implements '.implode(', ', $interfaceNames)) : '',
178 178
             $this->getFileName(),
179 179
             $this->getStartLine(),
180 180
             $this->getEndLine(),
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     {
216 216
         if (!isset($this->constants)) {
217 217
             $this->constants = $this->recursiveCollect(
218
-                function (array &$result, \ReflectionClass $instance) {
218
+                function(array &$result, \ReflectionClass $instance) {
219 219
                     $result += $instance->getConstants();
220 220
                 }
221 221
             );
@@ -282,14 +282,14 @@  discard block
 block discarded – undo
282 282
     /**
283 283
      * {@inheritDoc}
284 284
      */
285
-    public function getDocComment(): string|false
285
+    public function getDocComment(): string | false
286 286
     {
287 287
         $docComment = $this->classLikeNode->getDocComment();
288 288
 
289 289
         return $docComment ? $docComment->getText() : false;
290 290
     }
291 291
 
292
-    public function getEndLine(): int|false
292
+    public function getEndLine(): int | false
293 293
     {
294 294
         return $this->classLikeNode->getAttribute('endLine');
295 295
     }
@@ -299,12 +299,12 @@  discard block
 block discarded – undo
299 299
         return null;
300 300
     }
301 301
 
302
-    public function getExtensionName(): string|false
302
+    public function getExtensionName(): string | false
303 303
     {
304 304
         return false;
305 305
     }
306 306
 
307
-    public function getFileName(): string|false
307
+    public function getFileName(): string | false
308 308
     {
309 309
         return $this->classLikeNode->getAttribute('fileName');
310 310
     }
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     {
325 325
         if (!isset($this->interfaceClasses)) {
326 326
             $this->interfaceClasses = $this->recursiveCollect(
327
-                function (array &$result, \ReflectionClass $instance) {
327
+                function(array &$result, \ReflectionClass $instance) {
328 328
                     if ($instance->isInterface()) {
329 329
                         $result[$instance->name] = $instance;
330 330
                     }
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
             }
350 350
         }
351 351
 
352
-        throw new ReflectionException("Method " . $this->getName() . "::" . $name . " does not exist");
352
+        throw new ReflectionException("Method ".$this->getName()."::".$name." does not exist");
353 353
     }
354 354
 
355 355
     /**
@@ -357,12 +357,12 @@  discard block
 block discarded – undo
357 357
      *
358 358
      * @return ReflectionMethod[]
359 359
      */
360
-    public function getMethods(int|null $filter = null): array
360
+    public function getMethods(int | null $filter = null): array
361 361
     {
362 362
         if (!isset($this->methods)) {
363 363
             $directMethods = ReflectionMethod::collectFromClassNode($this->classLikeNode, $this);
364 364
             $parentMethods = $this->recursiveCollect(
365
-                function (array &$result, \ReflectionClass $instance, $isParent) {
365
+                function(array &$result, \ReflectionClass $instance, $isParent) {
366 366
                     $reflectionMethods = [];
367 367
                     foreach ($instance->getMethods() as $reflectionMethod) {
368 368
                         if (!$isParent || !$reflectionMethod->isPrivate()) {
@@ -431,9 +431,9 @@  discard block
 block discarded – undo
431 431
      */
432 432
     public function getName(): string
433 433
     {
434
-        $namespaceName = $this->namespaceName ? $this->namespaceName . '\\' : '';
434
+        $namespaceName = $this->namespaceName ? $this->namespaceName.'\\' : '';
435 435
 
436
-        return $namespaceName . $this->getShortName();
436
+        return $namespaceName.$this->getShortName();
437 437
     }
438 438
 
439 439
     /**
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
     /**
448 448
      * {@inheritDoc}
449 449
      */
450
-    public function getParentClass(): \ReflectionClass|false
450
+    public function getParentClass(): \ReflectionClass | false
451 451
     {
452 452
         if (!isset($this->parentClass)) {
453 453
             static $extendsField = 'extends';
@@ -472,12 +472,12 @@  discard block
 block discarded – undo
472 472
      *
473 473
      * @return ReflectionProperty[]
474 474
      */
475
-    public function getProperties(int|null $filter = null): array
475
+    public function getProperties(int | null $filter = null): array
476 476
     {
477 477
         if (!isset($this->properties)) {
478 478
             $directProperties = ReflectionProperty::collectFromClassNode($this->classLikeNode, $this->getName());
479 479
             $parentProperties = $this->recursiveCollect(
480
-                function (array &$result, \ReflectionClass $instance, $isParent) {
480
+                function(array &$result, \ReflectionClass $instance, $isParent) {
481 481
                     $reflectionProperties = [];
482 482
                     foreach ($instance->getProperties() as $reflectionProperty) {
483 483
                         if (!$isParent || !$reflectionProperty->isPrivate()) {
@@ -520,13 +520,13 @@  discard block
 block discarded – undo
520 520
             }
521 521
         }
522 522
 
523
-        throw new ReflectionException("Property " . $this->getName() . "::" . $name . " does not exist");
523
+        throw new ReflectionException("Property ".$this->getName()."::".$name." does not exist");
524 524
     }
525 525
 
526 526
     /**
527 527
      * @inheritDoc
528 528
      */
529
-    public function getReflectionConstant(string $name): \ReflectionClassConstant|false
529
+    public function getReflectionConstant(string $name): \ReflectionClassConstant | false
530 530
     {
531 531
         $classConstants = $this->getReflectionConstants();
532 532
         foreach ($classConstants as $classConstant) {
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
                 $this->getName()
550 550
             );
551 551
             $parentClassConstants = $this->recursiveCollect(
552
-                function (array &$result, \ReflectionClass $instance, $isParent) {
552
+                function(array &$result, \ReflectionClass $instance, $isParent) {
553 553
                     $reflectionClassConstants = [];
554 554
                     foreach ($instance->getReflectionConstants() as $reflectionClassConstant) {
555 555
                         if (!$isParent || !$reflectionClassConstant->isPrivate()) {
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
         return $this->className;
576 576
     }
577 577
 
578
-    public function getStartLine(): int|false
578
+    public function getStartLine(): int | false
579 579
     {
580 580
         if ($this->classLikeNode->attrGroups !== []) {
581 581
             $attrGroups = $this->classLikeNode->attrGroups;
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
                         break;
610 610
                     }
611 611
                 }
612
-                $aliases[$adaptation->newName] = $traitName . '::' . $methodName;
612
+                $aliases[$adaptation->newName] = $traitName.'::'.$methodName;
613 613
             }
614 614
         }
615 615
 
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
     /**
691 691
      * {@inheritDoc}
692 692
      */
693
-    public function implementsInterface(\ReflectionClass|string $interfaceName): bool
693
+    public function implementsInterface(\ReflectionClass | string $interfaceName): bool
694 694
     {
695 695
         $allInterfaces = $this->getInterfaces();
696 696
 
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
     /**
830 830
      * {@inheritDoc}
831 831
      */
832
-    public function isSubclassOf(\ReflectionClass|string $class): bool
832
+    public function isSubclassOf(\ReflectionClass | string $class): bool
833 833
     {
834 834
         if ($class instanceof \ReflectionClass) {
835 835
             $className = $class->name;
Please login to merge, or discard this patch.
src/Traits/ReflectionFunctionLikeTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 {
36 36
     use InitializationTrait;
37 37
 
38
-    protected FunctionLike|Function_|ClassMethod $functionLikeNode;
38
+    protected FunctionLike | Function_ | ClassMethod $functionLikeNode;
39 39
 
40 40
     /**
41 41
      * Namespace name
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
         return parent::getClosureThis();
68 68
     }
69 69
 
70
-    public function getDocComment(): string|false
70
+    public function getDocComment(): string | false
71 71
     {
72 72
         $docComment = $this->functionLikeNode->getDocComment();
73 73
 
74 74
         return $docComment ? $docComment->getText() : false;
75 75
     }
76 76
 
77
-    public function getEndLine(): int|false
77
+    public function getEndLine(): int | false
78 78
     {
79 79
         if ($this->functionLikeNode->hasAttribute('endLine')) {
80 80
             return $this->functionLikeNode->getAttribute('endLine');
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
         return null;
89 89
     }
90 90
 
91
-    public function getExtensionName(): string|false
91
+    public function getExtensionName(): string | false
92 92
     {
93 93
         return false;
94 94
     }
95 95
 
96
-    public function getFileName(): string|false
96
+    public function getFileName(): string | false
97 97
     {
98 98
         if ($this->functionLikeNode->hasAttribute('fileName')) {
99 99
             return $this->functionLikeNode->getAttribute('fileName');
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         if ($this->functionLikeNode instanceof Function_ || $this->functionLikeNode instanceof ClassMethod) {
111 111
             $functionName = $this->functionLikeNode->name->toString();
112 112
 
113
-            return $this->namespaceName ? $this->namespaceName . '\\' . $functionName : $functionName;
113
+            return $this->namespaceName ? $this->namespaceName.'\\'.$functionName : $functionName;
114 114
         }
115 115
 
116 116
         return '';
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             foreach ($this->functionLikeNode->getParams() as $parameterIndex => $parameterNode) {
163 163
                 $reflectionParameter = new ReflectionParameter(
164 164
                     $this->getName(),
165
-                    (string)$parameterNode->var->name,
165
+                    (string) $parameterNode->var->name,
166 166
                     $parameterNode,
167 167
                     $parameterIndex,
168 168
                     $this
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      *
183 183
      * @link http://php.net/manual/en/reflectionfunctionabstract.getreturntype.php
184 184
      */
185
-    public function getReturnType(): \ReflectionNamedType|\ReflectionUnionType|\ReflectionIntersectionType|null
185
+    public function getReturnType(): \ReflectionNamedType | \ReflectionUnionType | \ReflectionIntersectionType | null
186 186
     {
187 187
         if ($this->hasReturnType()) {
188 188
             $typeResolver = new TypeExpressionResolver($this);
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         throw new ReflectionException('unable to get short name');
207 207
     }
208 208
 
209
-    public function getStartLine(): int|false
209
+    public function getStartLine(): int | false
210 210
     {
211 211
         if ($this->functionLikeNode->attrGroups !== []) {
212 212
             $attrGroups = $this->functionLikeNode->attrGroups;
Please login to merge, or discard this patch.
src/ReflectionFunction.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -120,13 +120,13 @@
 block discarded – undo
120 120
 
121 121
         return sprintf(
122 122
             $reflectionFormat,
123
-            $this->getDocComment() ? $this->getDocComment() . "\n" : '',
123
+            $this->getDocComment() ? $this->getDocComment()."\n" : '',
124 124
             $this->getName(),
125 125
             $this->getFileName(),
126 126
             $this->getStartLine(),
127 127
             $this->getEndLine(),
128 128
             count($this->getParameters()),
129
-            array_reduce($this->getParameters(), static fn($str, ReflectionParameter $param) => $str . "\n    " . $param, '')
129
+            array_reduce($this->getParameters(), static fn($str, ReflectionParameter $param) => $str."\n    ".$param, '')
130 130
         );
131 131
     }
132 132
 
Please login to merge, or discard this patch.
src/ReflectionType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,14 +67,14 @@
 block discarded – undo
67 67
         if ($type instanceof ReflectionNamedType) {
68 68
             $displayType = $type->getName();
69 69
         } else {
70
-            $displayType = (string)$type;
70
+            $displayType = (string) $type;
71 71
         }
72 72
 
73 73
         $displayType = ltrim($displayType, '\\');
74 74
 
75 75
         $specialNullableTypes = in_array($displayType, ['mixed', 'null'], true);
76 76
         if ($type->allowsNull() && !$type instanceof ReflectionUnionType && !$specialNullableTypes) {
77
-            $displayType = '?' . $displayType;
77
+            $displayType = '?'.$displayType;
78 78
         }
79 79
 
80 80
         return $displayType;
Please login to merge, or discard this patch.
src/ReflectionClassConstant.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
     /**
35 35
      * Concrete class constant node
36 36
      */
37
-    private ClassConst|EnumCase $classConstOrEnumCaseNode;
37
+    private ClassConst | EnumCase $classConstOrEnumCaseNode;
38 38
 
39
-    private Const_|EnumCase $constOrEnumCaseNode;
39
+    private Const_ | EnumCase $constOrEnumCaseNode;
40 40
 
41 41
     private string $className;
42 42
 
43 43
     private mixed $value = null;
44 44
 
45
-    private \ReflectionUnionType|\ReflectionNamedType|\ReflectionIntersectionType|null $type = null;
45
+    private \ReflectionUnionType | \ReflectionNamedType | \ReflectionIntersectionType | null $type = null;
46 46
 
47 47
     /**
48 48
      * Parses class constants from the concrete class node
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
     public function __construct(
87 87
         string $className,
88 88
         string $classConstantName,
89
-        ClassConst|EnumCase|null $classConstNode = null,
90
-        Const_|EnumCase|null $constNode = null
89
+        ClassConst | EnumCase | null $classConstNode = null,
90
+        Const_ | EnumCase | null $constNode = null
91 91
     ) {
92 92
         $this->className = ltrim($className, '\\');
93 93
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     /**
142 142
      * @inheritDoc
143 143
      */
144
-    public function getDocComment(): string|false
144
+    public function getDocComment(): string | false
145 145
     {
146 146
         $docBlock = $this->classConstOrEnumCaseNode->getDocComment();
147 147
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
         ];
256 256
         $value = $this->isEnumCase() ? 'Object' : $this->getValue();
257 257
         if (!$this->hasType()) {
258
-            $type  = gettype($value);
258
+            $type = gettype($value);
259 259
             if (isset($typeMap[$type])) {
260 260
                 $type = $typeMap[$type];
261 261
             }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         );
279 279
     }
280 280
 
281
-    public function getNode(): ClassConst|EnumCase
281
+    public function getNode(): ClassConst | EnumCase
282 282
     {
283 283
         return $this->classConstOrEnumCaseNode;
284 284
     }
Please login to merge, or discard this patch.
src/Locator/CallableLocator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      *
36 36
      * @param string $className Name of the class
37 37
      */
38
-    public function locateClass(string $className): false|string
38
+    public function locateClass(string $className): false | string
39 39
     {
40 40
         return call_user_func($this->callable, ltrim($className, '\\'));
41 41
     }
Please login to merge, or discard this patch.
src/Locator/ComposerLocator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
      *
51 51
      * @param string $className Name of the class
52 52
      **/
53
-    public function locateClass(string $className): false|string
53
+    public function locateClass(string $className): false | string
54 54
     {
55 55
         $filePath = $this->loader->findFile(ltrim($className, '\\'));
56 56
         if (!empty($filePath)) {
Please login to merge, or discard this patch.
src/ReflectionParameter.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 
75 75
     private ?string $defaultValueConstExpr;
76 76
 
77
-    private \ReflectionUnionType|\ReflectionNamedType|\ReflectionIntersectionType|null $type = null;
77
+    private \ReflectionUnionType | \ReflectionNamedType | \ReflectionIntersectionType | null $type = null;
78 78
 
79 79
     /**
80 80
      * Initializes a reflection for the property
81 81
      */
82 82
     public function __construct(
83
-        string|array $unusedFunctionName,
83
+        string | array $unusedFunctionName,
84 84
         string $parameterName,
85 85
         Param $parameterNode,
86 86
         int $parameterIndex,
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     public function __debugInfo(): array
136 136
     {
137 137
         return [
138
-            'name' => (string)$this->parameterNode->var->name,
138
+            'name' => (string) $this->parameterNode->var->name,
139 139
         ];
140 140
     }
141 141
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             // For constant fetch expressions, PHP renders now expression
153 153
             if ($this->isDefaultValueConstExpr) {
154 154
                 $defaultValue = $this->defaultValueConstExpr;
155
-            } elseif ($this->isDefaultValueConstant){
155
+            } elseif ($this->isDefaultValueConstant) {
156 156
                 $defaultValue = $this->defaultValueConstantName;
157 157
             } else {
158 158
                 $defaultValue = var_export($this->getDefaultValue(), true);
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
             'Parameter #%d [ %s %s%s%s$%s%s ]',
164 164
             $this->parameterIndex,
165 165
             $isOptional ? '<optional>' : '<required>',
166
-            $parameterType ? ReflectionType::convertToDisplayType($parameterType) . ' ' : '',
166
+            $parameterType ? ReflectionType::convertToDisplayType($parameterType).' ' : '',
167 167
             $this->isVariadic() ? '...' : '',
168 168
             $this->isPassedByReference() ? '&' : '',
169 169
             $this->getName(),
170
-            ($isOptional && $hasDefaultValue) ? (' = ' . $defaultValue) : ''
170
+            ($isOptional && $hasDefaultValue) ? (' = '.$defaultValue) : ''
171 171
         );
172 172
     }
173 173
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
     /**
263 263
      * {@inheritDoc}
264 264
      */
265
-    public function getDefaultValueConstantName(): null|string
265
+    public function getDefaultValueConstantName(): null | string
266 266
     {
267 267
         if (!$this->isDefaultValueAvailable()) {
268 268
             throw new ReflectionException('Internal error: Failed to retrieve the default value');
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
      */
277 277
     public function getName(): string
278 278
     {
279
-        return (string)$this->parameterNode->var->name;
279
+        return (string) $this->parameterNode->var->name;
280 280
     }
281 281
 
282 282
     /**
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     /**
291 291
      * @inheritDoc
292 292
      */
293
-    public function getType(): \ReflectionNamedType|\ReflectionUnionType|\ReflectionIntersectionType|null
293
+    public function getType(): \ReflectionNamedType | \ReflectionUnionType | \ReflectionIntersectionType | null
294 294
     {
295 295
         return $this->type;
296 296
     }
Please login to merge, or discard this patch.