Completed
Pull Request — master (#81)
by Loren
02:17
created
src/ReflectionExtension.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
     /**
31 31
      * Has extension been loaded by PHP.
32 32
      *
33
-     * @return true
33
+     * @return boolean
34 34
      *     Enabled extensions are always loaded.
35 35
      */
36 36
     public function wasIncluded()
Please login to merge, or discard this patch.
src/ReflectionFunction.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     /**
33 33
      * Initializes reflection instance for given AST-node
34 34
      *
35
-     * @param string|\Closure $functionName The name of the function to reflect or a closure.
35
+     * @param string $functionName The name of the function to reflect or a closure.
36 36
      * @param Function_|null  $functionNode Function node AST
37 37
      */
38 38
     public function __construct($functionName, Function_ $functionNode = null)
Please login to merge, or discard this patch.
src/Traits/ReflectionClassLikeTrait.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -312,6 +312,9 @@
 block discarded – undo
312 312
         return new ReflectionExtension($extName);
313 313
     }
314 314
 
315
+    /**
316
+     * @return string
317
+     */
315 318
     public function getExtensionName()
316 319
     {
317 320
         if (!$this->classLikeNode) {
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
             }
135 135
         }
136 136
 
137
-        $buildString = function (array $items, $indentLevel = 4) {
137
+        $buildString = function(array $items, $indentLevel = 4) {
138 138
             if (!count($items)) {
139 139
                 return '';
140 140
             }
141
-            $indent = "\n" . str_repeat(' ', $indentLevel);
142
-            return $indent . implode($indent, explode("\n", implode("\n", $items)));
141
+            $indent = "\n".str_repeat(' ', $indentLevel);
142
+            return $indent.implode($indent, explode("\n", implode("\n", $items)));
143 143
         };
144
-        $buildConstants = function (array $items, $indentLevel = 4) {
144
+        $buildConstants = function(array $items, $indentLevel = 4) {
145 145
             $str = '';
146 146
             foreach ($items as $name => $value) {
147
-                $str .= "\n" . str_repeat(' ', $indentLevel);
147
+                $str .= "\n".str_repeat(' ', $indentLevel);
148 148
                 $str .= sprintf(
149 149
                     'Constant [ %s %s ] { %s }',
150 150
                     gettype($value),
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
             ($isObject ? 'Object of class' : 'Class'),
169 169
             $modifiers,
170 170
             $this->getName(),
171
-            false !== $parentClass ? (' extends ' . $parentClass->getName()) : '',
172
-            $interfaceNames ? (' implements ' . implode(', ', $interfaceNames)) : '',
171
+            false !== $parentClass ? (' extends '.$parentClass->getName()) : '',
172
+            $interfaceNames ? (' implements '.implode(', ', $interfaceNames)) : '',
173 173
             $this->getFileName(),
174 174
             $this->getStartLine(),
175 175
             $this->getEndLine(),
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
     {
211 211
         if (!isset($this->constants)) {
212 212
             if ($this->classLikeNode) {
213
-                $this->constants = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance) {
213
+                $this->constants = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance) {
214 214
                     $result += $instance->getConstants();
215 215
                 });
216 216
                 $this->collectSelfConstants();
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         $staticOrder   = [true, false];
257 257
         foreach ($staticOrder as $shouldBeStatic) {
258 258
             foreach ($properties as $property) {
259
-                $isStaticProperty     = $property->isStatic();
259
+                $isStaticProperty = $property->isStatic();
260 260
                 if ($shouldBeStatic !== $isStaticProperty) {
261 261
                     continue;
262 262
                 }
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
     {
348 348
         if (!isset($this->interfaceClasses)) {
349 349
             if ($this->classLikeNode) {
350
-                $this->interfaceClasses = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance) {
350
+                $this->interfaceClasses = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance) {
351 351
                     if ($instance->isInterface()) {
352 352
                         $result[$instance->name] = $instance;
353 353
                     }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
         if (!isset($this->methods)) {
395 395
             if ($this->classLikeNode) {
396 396
                 $directMethods = ReflectionMethod::collectFromClassNode($this->classLikeNode, $this);
397
-                $parentMethods = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance, $isParent) {
397
+                $parentMethods = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance, $isParent) {
398 398
                     $reflectionMethods = [];
399 399
                     foreach ($instance->getMethods() as $reflectionMethod) {
400 400
                         if (!$isParent || !$reflectionMethod->isPrivate()) {
@@ -477,9 +477,9 @@  discard block
 block discarded – undo
477 477
      */
478 478
     public function getName()
479 479
     {
480
-        $namespaceName = $this->namespaceName ? $this->namespaceName . '\\' : '';
480
+        $namespaceName = $this->namespaceName ? $this->namespaceName.'\\' : '';
481 481
 
482
-        return $namespaceName . $this->getShortName();
482
+        return $namespaceName.$this->getShortName();
483 483
     }
484 484
 
485 485
     /**
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
         if (!isset($this->properties)) {
534 534
             if ($this->classLikeNode) {
535 535
                 $directProperties = ReflectionProperty::collectFromClassNode($this->classLikeNode, $this->getName());
536
-                $parentProperties = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance, $isParent) {
536
+                $parentProperties = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance, $isParent) {
537 537
                     $reflectionProperties = [];
538 538
                     foreach ($instance->getProperties() as $reflectionProperty) {
539 539
                         if (!$isParent || !$reflectionProperty->isPrivate()) {
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
                         break;
631 631
                     }
632 632
                 }
633
-                $aliases[$adaptation->newName] = $traitName . '::'. $methodName;
633
+                $aliases[$adaptation->newName] = $traitName.'::'.$methodName;
634 634
             }
635 635
         }
636 636
 
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
     {
1091 1091
         return
1092 1092
             interface_exists($this->getName(), false) ||
1093
-            trait_exists(    $this->getName(), false) ||
1094
-            class_exists(    $this->getName(), false);
1093
+            trait_exists($this->getName(), false) ||
1094
+            class_exists($this->getName(), false);
1095 1095
     }
1096 1096
 }
Please login to merge, or discard this patch.
src/Traits/ReflectionFunctionLikeTrait.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,6 +106,9 @@  discard block
 block discarded – undo
106 106
         return new ReflectionExtension($extName);
107 107
     }
108 108
 
109
+    /**
110
+     * @return string
111
+     */
109 112
     public function getExtensionName()
110 113
     {
111 114
         if (!$this->functionLikeNode) {
@@ -223,7 +226,7 @@  discard block
 block discarded – undo
223 226
     /**
224 227
      * Gets the specified return type of a function
225 228
      *
226
-     * @return \ReflectionType
229
+     * @return null|ReflectionType
227 230
      *
228 231
      * @link http://php.net/manual/en/reflectionfunctionabstract.getreturntype.php
229 232
      */
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         if ($this->functionLikeNode instanceof Function_ || $this->functionLikeNode instanceof ClassMethod) {
139 139
             $functionName = $this->functionLikeNode->name;
140 140
 
141
-            return $this->namespaceName ? $this->namespaceName . '\\' . $functionName : $functionName;
141
+            return $this->namespaceName ? $this->namespaceName.'\\'.$functionName : $functionName;
142 142
         }
143 143
 
144 144
         return false;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      */
230 230
     public function getReturnType()
231 231
     {
232
-        $isBuiltin  = false;
232
+        $isBuiltin = false;
233 233
         if ($this->functionLikeNode) {
234 234
             $returnType = $this->functionLikeNode->getReturnType();
235 235
             $isNullable = $returnType instanceof NullableType;
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
             }
256 256
             $isNullable = $nativeType->allowsNull();
257 257
             $isBuiltin = $nativeType->isBuiltin();
258
-            $returnType = (string)$nativeType;
258
+            $returnType = (string) $nativeType;
259 259
         }
260 260
 
261 261
         return new ReflectionType($returnType, $isNullable, $isBuiltin);
@@ -482,9 +482,9 @@  discard block
 block discarded – undo
482 482
         }
483 483
         if (method_exists($orig, 'hasType') && $orig->hasType()) {
484 484
             $typeRef = $orig->getType();
485
-            $stringType = ltrim((string)$typeRef, '?'); // ltrim() is precautionary.
485
+            $stringType = ltrim((string) $typeRef, '?'); // ltrim() is precautionary.
486 486
             if (PHP_VERSION_ID >= 70100 && $typeRef->allowsNull()) {
487
-                $stringType = '?' . $stringType;
487
+                $stringType = '?'.$stringType;
488 488
                 $nullableImplied = true;
489 489
             }
490 490
             $builder->setTypeHint($stringType);
@@ -505,9 +505,9 @@  discard block
 block discarded – undo
505 505
             $fakeParamNode->setAttribute('prohibit_null', true);
506 506
         }
507 507
         return new ReflectionParameter(
508
-            $this->getName(),     // Calling function name:   Unused.
509
-            $orig->getName(),     // Parameter variable name: Unused.
510
-            $fakeParamNode,       // Synthetic parse node.
508
+            $this->getName(), // Calling function name:   Unused.
509
+            $orig->getName(), // Parameter variable name: Unused.
510
+            $fakeParamNode, // Synthetic parse node.
511 511
             $orig->getPosition(), // Parameter index.
512 512
             $this                 // Function or method being described.
513 513
         );
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
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
         $paramString = '';
134 134
         $identation  = str_repeat(' ', 4);
135 135
         foreach ($methodParameters as $methodParameter) {
136
-            $paramString .= "\n{$identation}" . $methodParameter;
136
+            $paramString .= "\n{$identation}".$methodParameter;
137 137
         }
138 138
 
139 139
         return sprintf(
140 140
             "%sMethod [ <user%s%s%s>%s%s%s %s method %s ] {\n  @@ %s %d - %d{$paramFormat}{$returnFormat}\n}\n",
141
-            $this->getDocComment() ? $this->getDocComment() . "\n" : '',
141
+            $this->getDocComment() ? $this->getDocComment()."\n" : '',
142 142
             $prototype ? ", overwrites {$prototypeClass}, prototype {$prototypeClass}" : '',
143 143
             $this->isConstructor() ? ', ctor' : '',
144 144
             $this->isDestructor() ? ', dtor' : '',
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
     {
411 411
         return
412 412
             interface_exists($this->className, false) ||
413
-            trait_exists(    $this->className, false) ||
414
-            class_exists(    $this->className, false);
413
+            trait_exists($this->className, false) ||
414
+            class_exists($this->className, false);
415 415
     }
416 416
 }
Please login to merge, or discard this patch.
src/ReflectionProperty.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -351,7 +351,7 @@
 block discarded – undo
351 351
     {
352 352
         return
353 353
             interface_exists($this->className, false) ||
354
-            trait_exists(    $this->className, false) ||
355
-            class_exists(    $this->className, false);
354
+            trait_exists($this->className, false) ||
355
+            class_exists($this->className, false);
356 356
     }
357 357
 }
Please login to merge, or discard this patch.
src/ValueResolver/NodeExpressionResolver.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     protected function resolveScalarMagicConstMethod()
142 142
     {
143 143
         if ($this->context instanceof \ReflectionMethod) {
144
-            $fullName = $this->context->getDeclaringClass()->name . '::' . $this->context->getShortName();
144
+            $fullName = $this->context->getDeclaringClass()->name.'::'.$this->context->getShortName();
145 145
 
146 146
             return $fullName;
147 147
         }
@@ -228,13 +228,13 @@  discard block
 block discarded – undo
228 228
 
229 229
         if (!$isFQNConstant) {
230 230
             if (method_exists($this->context, 'getFileName')) {
231
-                $fileName      = $this->context->getFileName();
231
+                $fileName = $this->context->getFileName();
232 232
                 if ($fileName !== false) {
233 233
                     $namespaceName = $this->resolveScalarMagicConstNamespace();
234 234
                     $fileNamespace = new ReflectionFileNamespace($fileName, $namespaceName);
235 235
                     if ($fileNamespace->hasConstant($constantName)) {
236 236
                         $constantValue = $fileNamespace->getConstant($constantName);
237
-                        $constantName  = $fileNamespace->getName() . '\\' . $constantName;
237
+                        $constantName  = $fileNamespace->getName().'\\'.$constantName;
238 238
                         $isResolved    = true;
239 239
                     }
240 240
                 }
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 $reason = 'Unable';
263 263
                 if ($classToReflect instanceof Expr) {
264 264
                     $methodName = $this->getDispatchMethodFor($classToReflect);
265
-                    $reason = "Method " . __CLASS__ . "::{$methodName}() not found trying";
265
+                    $reason = "Method ".__CLASS__."::{$methodName}() not found trying";
266 266
                 }
267 267
                 throw new ReflectionException("$reason to resolve class constant.");
268 268
             }
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         }
280 280
 
281 281
         $this->isConstant = true;
282
-        $this->constantName = (string)$classToReflect . '::' . $constantName;
282
+        $this->constantName = (string) $classToReflect.'::'.$constantName;
283 283
 
284 284
         return $refClass->getConstant($constantName);
285 285
     }
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 
364 364
     protected function resolveExprBinaryOpConcat(Expr\BinaryOp\Concat $node)
365 365
     {
366
-        return $this->resolve($node->left) . $this->resolve($node->right);
366
+        return $this->resolve($node->left).$this->resolve($node->right);
367 367
     }
368 368
 
369 369
     protected function resolveExprTernary(Expr\Ternary $node)
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
     private function getDispatchMethodFor(Node $node)
448 448
     {
449 449
         $nodeType = $node->getType();
450
-        return 'resolve' . str_replace('_', '', $nodeType);
450
+        return 'resolve'.str_replace('_', '', $nodeType);
451 451
     }
452 452
 
453 453
     /**
Please login to merge, or discard this patch.
src/ReflectionType.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             'int'  => 'integer',
86 86
             'bool' => 'boolean'
87 87
         ];
88
-        $displayType = (string)$type;
88
+        $displayType = (string) $type;
89 89
         if (isset($typeMap[$displayType])) {
90 90
             $displayType = $typeMap[$displayType];
91 91
         }
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
     public function wasIncluded()
109 109
     {
110 110
         return
111
-            $this->isBuiltin()                   ||
111
+            $this->isBuiltin() ||
112 112
             interface_exists($this->type, false) ||
113
-            trait_exists(    $this->type, false) ||
114
-            class_exists(    $this->type, false);
113
+            trait_exists($this->type, false) ||
114
+            class_exists($this->type, false);
115 115
     }
116 116
 }
Please login to merge, or discard this patch.