Completed
Pull Request — master (#122)
by
unknown
21:45
created
src/Traits/ReflectionClassLikeTrait.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
      */
226 226
     public function getConstants(
227 227
         ?int $filter = ReflectionClassConstant::IS_PUBLIC
228
-                      |ReflectionClassConstant::IS_PROTECTED
229
-                      |ReflectionClassConstant::IS_PRIVATE
228
+                        |ReflectionClassConstant::IS_PROTECTED
229
+                        |ReflectionClassConstant::IS_PRIVATE
230 230
     ): array {
231 231
         if (!isset($this->constants)) {
232 232
             $this->constants = $this->recursiveCollect(
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
      */
567 567
     public function getReflectionConstants(
568 568
         ?int $filter = ReflectionClassConstant::IS_PUBLIC
569
-                      |ReflectionClassConstant::IS_PROTECTED
570
-                      |ReflectionClassConstant::IS_PRIVATE
569
+                        |ReflectionClassConstant::IS_PROTECTED
570
+                        |ReflectionClassConstant::IS_PRIVATE
571 571
     ): array {
572 572
         if (!isset($this->classConstants)) {
573 573
             $directClassConstants = ReflectionClassConstant::collectFromClassNode(
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      *
101 101
      * @var BaseReflectionClass|false|null
102 102
      */
103
-    protected null|BaseReflectionClass|false $parentClass;
103
+    protected null | BaseReflectionClass | false $parentClass;
104 104
 
105 105
     /**
106 106
      * @var ReflectionProperty[]|null
@@ -149,19 +149,19 @@  discard block
 block discarded – undo
149 149
             }
150 150
         }
151 151
 
152
-        $buildString = static function (array $items, $indentLevel = 4) {
152
+        $buildString = static function(array $items, $indentLevel = 4) {
153 153
             if (!count($items)) {
154 154
                 return '';
155 155
             }
156
-            $indent = "\n" . str_repeat(' ', $indentLevel);
156
+            $indent = "\n".str_repeat(' ', $indentLevel);
157 157
 
158
-            return $indent . implode($indent, explode("\n", implode("\n", $items)));
158
+            return $indent.implode($indent, explode("\n", implode("\n", $items)));
159 159
         };
160 160
 
161
-        $buildConstants = static function (array $items, $indentLevel = 4) {
161
+        $buildConstants = static function(array $items, $indentLevel = 4) {
162 162
             $str = '';
163 163
             foreach ($items as $name => $value) {
164
-                $str .= "\n" . str_repeat(' ', $indentLevel);
164
+                $str .= "\n".str_repeat(' ', $indentLevel);
165 165
                 $str .= sprintf(
166 166
                     'Constant [ %s %s ] { %s }',
167 167
                     gettype($value),
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
             ($isObject ? 'Object of class' : 'Class'),
187 187
             $modifiers,
188 188
             $this->getName(),
189
-            false !== $parentClass ? (' extends ' . $parentClass->getName()) : '',
190
-            $interfaceNames ? (' implements ' . implode(', ', $interfaceNames)) : '',
189
+            false !== $parentClass ? (' extends '.$parentClass->getName()) : '',
190
+            $interfaceNames ? (' implements '.implode(', ', $interfaceNames)) : '',
191 191
             $this->getFileName(),
192 192
             $this->getStartLine(),
193 193
             $this->getEndLine(),
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     ): array {
231 231
         if (!isset($this->constants)) {
232 232
             $this->constants = $this->recursiveCollect(
233
-                function (array &$result, BaseReflectionClass $instance) {
233
+                function(array &$result, BaseReflectionClass $instance) {
234 234
                     $result += $instance->getConstants();
235 235
                 }
236 236
             );
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     /**
294 294
      * {@inheritDoc}
295 295
      */
296
-    public function getDocComment(): string|false
296
+    public function getDocComment(): string | false
297 297
     {
298 298
         $docComment = $this->classLikeNode->getDocComment();
299 299
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     /**
304 304
      * {@inheritDoc}
305 305
      */
306
-    public function getEndLine(): int|false
306
+    public function getEndLine(): int | false
307 307
     {
308 308
         return $this->classLikeNode->getAttribute('endLine');
309 309
     }
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     /**
325 325
      * {@inheritDoc}
326 326
      */
327
-    public function getExtensionName(): string|false
327
+    public function getExtensionName(): string | false
328 328
     {
329 329
         return false;
330 330
     }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
     /**
333 333
      * {@inheritDoc}
334 334
      */
335
-    public function getFileName(): string|false
335
+    public function getFileName(): string | false
336 336
     {
337 337
         return $this->classLikeNode->getAttribute('fileName');
338 338
     }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
     {
353 353
         if (!isset($this->interfaceClasses)) {
354 354
             $this->interfaceClasses = $this->recursiveCollect(
355
-                function (array &$result, BaseReflectionClass $instance) {
355
+                function(array &$result, BaseReflectionClass $instance) {
356 356
                     if ($instance->isInterface()) {
357 357
                         $result[$instance->name] = $instance;
358 358
                     }
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
         if (!isset($this->methods)) {
396 396
             $directMethods = ReflectionMethod::collectFromClassNode($this->classLikeNode, $this);
397 397
             $parentMethods = $this->recursiveCollect(
398
-                function (array &$result, BaseReflectionClass $instance, $isParent) {
398
+                function(array &$result, BaseReflectionClass $instance, $isParent) {
399 399
                     $reflectionMethods = [];
400 400
                     foreach ($instance->getMethods() as $reflectionMethod) {
401 401
                         if (!$isParent || !$reflectionMethod->isPrivate()) {
@@ -439,9 +439,9 @@  discard block
 block discarded – undo
439 439
      */
440 440
     public function getName(): string
441 441
     {
442
-        $namespaceName = $this->namespaceName ? $this->namespaceName . '\\' : '';
442
+        $namespaceName = $this->namespaceName ? $this->namespaceName.'\\' : '';
443 443
 
444
-        return $namespaceName . $this->getShortName();
444
+        return $namespaceName.$this->getShortName();
445 445
     }
446 446
 
447 447
     /**
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
      * @return ReflectionClass|false A {@see ReflectionClass} or {@see false}
461 461
      *                               if there's no parent.
462 462
      */
463
-    public function getParentClass(): BaseReflectionClass|false
463
+    public function getParentClass(): BaseReflectionClass | false
464 464
     {
465 465
         if (!isset($this->parentClass)) {
466 466
             static $extendsField = 'extends';
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
         if (!isset($this->properties)) {
487 487
             $directProperties = ReflectionProperty::collectFromClassNode($this->classLikeNode, $this->getName());
488 488
             $parentProperties = $this->recursiveCollect(
489
-                function (array &$result, BaseReflectionClass $instance, $isParent) {
489
+                function(array &$result, BaseReflectionClass $instance, $isParent) {
490 490
                     $reflectionProperties = [];
491 491
                     foreach ($instance->getProperties() as $reflectionProperty) {
492 492
                         if (!$isParent || !$reflectionProperty->isPrivate()) {
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
      *
550 550
      * @return ReflectionClassConstant|false A {@see ReflectionClassConstant}.
551 551
      */
552
-    public function getReflectionConstant(string $name): BaseReflectionClassConstant|false
552
+    public function getReflectionConstant(string $name): BaseReflectionClassConstant | false
553 553
     {
554 554
         $classConstants = $this->getReflectionConstants();
555 555
         foreach ($classConstants as $classConstant) {
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
                 $this->getName()
576 576
             );
577 577
             $parentClassConstants = $this->recursiveCollect(
578
-                function (array &$result, BaseReflectionClass $instance, $isParent) {
578
+                function(array &$result, BaseReflectionClass $instance, $isParent) {
579 579
                     $reflectionClassConstants = [];
580 580
                     foreach ($instance->getReflectionConstants() as $reflectionClassConstant) {
581 581
                         if (!$isParent || !$reflectionClassConstant->isPrivate()) {
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
     /**
605 605
      * {@inheritDoc}
606 606
      */
607
-    public function getStartLine(): int|false
607
+    public function getStartLine(): int | false
608 608
     {
609 609
         return $this->classLikeNode->getAttribute('startLine');
610 610
     }
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
                         break;
627 627
                     }
628 628
                 }
629
-                $aliases[$adaptation->newName] = $traitName . '::' . $methodName;
629
+                $aliases[$adaptation->newName] = $traitName.'::'.$methodName;
630 630
             }
631 631
         }
632 632
 
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
      *
709 709
      * @return bool Returns {@see true} on success or {@see false} on failure.
710 710
      */
711
-    public function implementsInterface(BaseReflectionClass|string $interface): bool
711
+    public function implementsInterface(BaseReflectionClass | string $interface): bool
712 712
     {
713 713
         $allInterfaces = $this->getInterfaces();
714 714
 
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
      *
841 841
      * @return bool {@see true} on success or {@see false} on failure.
842 842
      */
843
-    public function isSubclassOf(BaseReflectionClass|string $class): bool
843
+    public function isSubclassOf(BaseReflectionClass | string $class): bool
844 844
     {
845 845
         if ($class instanceof ReflectionClass) {
846 846
             $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
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
         return parent::getClosureThis();
75 75
     }
76 76
 
77
-    public function getDocComment(): string|false
77
+    public function getDocComment(): string | false
78 78
     {
79 79
         $docComment = $this->functionLikeNode->getDocComment();
80 80
 
81 81
         return $docComment ? $docComment->getText() : false;
82 82
     }
83 83
 
84
-    public function getEndLine(): int|false
84
+    public function getEndLine(): int | false
85 85
     {
86 86
         return $this->functionLikeNode->getAttribute('endLine');
87 87
     }
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
         return null;
92 92
     }
93 93
 
94
-    public function getExtensionName(): string|false
94
+    public function getExtensionName(): string | false
95 95
     {
96 96
         return false;
97 97
     }
98 98
 
99
-    public function getFileName(): string|false
99
+    public function getFileName(): string | false
100 100
     {
101 101
         return $this->functionLikeNode->getAttribute('fileName');
102 102
     }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         if ($this->functionLikeNode instanceof Function_ || $this->functionLikeNode instanceof ClassMethod) {
110 110
             $functionName = $this->functionLikeNode->name->toString();
111 111
 
112
-            return $this->namespaceName ? $this->namespaceName . '\\' . $functionName : $functionName;
112
+            return $this->namespaceName ? $this->namespaceName.'\\'.$functionName : $functionName;
113 113
         }
114 114
 
115 115
         /** @noinspection PhpMultipleClassDeclarationsInspection */
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
             foreach ($this->functionLikeNode->getParams() as $parameterIndex => $parameterNode) {
167 167
                 $reflectionParameter = new ReflectionParameter(
168 168
                     $this->getName(),
169
-                    (string)$parameterNode->var->name,
169
+                    (string) $parameterNode->var->name,
170 170
                     $parameterNode,
171 171
                     $parameterIndex,
172 172
                     $this
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
         return parent::getShortName();
221 221
     }
222 222
 
223
-    public function getStartLine(): int|false
223
+    public function getStartLine(): int | false
224 224
     {
225 225
         return $this->functionLikeNode->getAttribute('startLine');
226 226
     }
Please login to merge, or discard this patch.
src/Instrument/PathResolver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      *
32 32
      * @return array|bool|string
33 33
      */
34
-    public static function realpath(array|string $somePath, bool $shouldCheckExistence = false): bool|array|string
34
+    public static function realpath(array | string $somePath, bool $shouldCheckExistence = false): bool | array | string
35 35
     {
36 36
         // Do not resolve empty string/false/arrays into the current path
37 37
         if (!$somePath) {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
         $isRelative = !$pathScheme && ($path[0] !== '/') && ($path[1] !== ':');
54 54
         if ($isRelative) {
55
-            $path = getcwd() . DIRECTORY_SEPARATOR . $path;
55
+            $path = getcwd().DIRECTORY_SEPARATOR.$path;
56 56
         }
57 57
 
58 58
         // resolve path parts (single dot, double dot and double delimiters)
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 bool|ReflectionClass
105 105
      */
106
-    public function getClass(string $className): bool|ReflectionClass
106
+    public function getClass(string $className): bool | ReflectionClass
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];
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
         foreach ($this->namespaceNode->stmts as $namespaceLevelNode) {
325 325
             if ($namespaceLevelNode instanceof ClassLike) {
326 326
                 $classShortName = $namespaceLevelNode->name->toString();
327
-                $className = $namespaceName ? $namespaceName .'\\' . $classShortName : $classShortName;
327
+                $className = $namespaceName ? $namespaceName.'\\'.$classShortName : $classShortName;
328 328
 
329 329
                 $namespaceLevelNode->setAttribute('fileName', $this->fileName);
330 330
                 $classes[$className] = new ReflectionClass($className, $namespaceLevelNode);
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         foreach ($this->namespaceNode->stmts as $namespaceLevelNode) {
349 349
             if ($namespaceLevelNode instanceof Function_) {
350 350
                 $funcShortName = $namespaceLevelNode->name->toString();
351
-                $functionName  = $namespaceName ? $namespaceName .'\\' . $funcShortName : $funcShortName;
351
+                $functionName  = $namespaceName ? $namespaceName.'\\'.$funcShortName : $funcShortName;
352 352
 
353 353
                 $namespaceLevelNode->setAttribute('fileName', $this->fileName);
354 354
                 $functions[$funcShortName] = new ReflectionFunction($functionName, $namespaceLevelNode);
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
                 if ($namespaceLevelNode instanceof Expression
389 389
                     && $namespaceLevelNode->expr instanceof FuncCall
390 390
                     && $namespaceLevelNode->expr->name instanceof Name
391
-                    && (string)$namespaceLevelNode->expr->name === 'define'
391
+                    && (string) $namespaceLevelNode->expr->name === 'define'
392 392
                 ) {
393 393
                     $functionCallNode = $namespaceLevelNode->expr;
394 394
                     $expressionSolver->process($functionCallNode->args[0]->value);
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
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
         $paramString = '';
116 116
         $indentation = str_repeat(' ', 4);
117 117
         foreach ($methodParameters as $methodParameter) {
118
-            $paramString .= "\n$indentation" . $methodParameter;
118
+            $paramString .= "\n$indentation".$methodParameter;
119 119
         }
120 120
 
121 121
         /** @noinspection PhpFormatFunctionParametersMismatchInspection */
122 122
         return sprintf(
123 123
             "%sMethod [ <user%s%s%s>%s%s%s %s method %s ] {\n  @@ %s %d - %d$paramFormat$returnFormat\n}\n",
124
-            $this->getDocComment() ? $this->getDocComment() . "\n" : '',
124
+            $this->getDocComment() ? $this->getDocComment()."\n" : '',
125 125
             $prototype ? ", overwrites $prototypeClass, prototype $prototypeClass" : '',
126 126
             $this->isConstructor() ? ', ctor' : '',
127 127
             $this->isFinal() ? ' final' : '',
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     /**
157 157
      * {@inheritDoc}
158 158
      */
159
-    public function getDeclaringClass(): \ReflectionClass|ReflectionClass
159
+    public function getDeclaringClass(): \ReflectionClass | ReflectionClass
160 160
     {
161 161
         return $this->declaringClass ?? new ReflectionClass($this->className);
162 162
     }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     /**
193 193
      * {@inheritDoc}
194 194
      */
195
-    public function getPrototype(): BaseReflectionMethod|ReflectionMethod
195
+    public function getPrototype(): BaseReflectionMethod | ReflectionMethod
196 196
     {
197 197
         $parent = $this->getDeclaringClass()->getParentClass();
198 198
         if (!$parent) {
Please login to merge, or discard this patch.