Completed
Push — master ( df78b5...cfee63 )
by Marco
11s
created
src/SourceLocator/SourceStubber/ReflectionSourceStubber.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         $this->addConstants($classNode, $classReflection);
84 84
         $this->addMethods($classNode, $classReflection);
85 85
 
86
-        if (! $classReflection->inNamespace()) {
86
+        if (!$classReflection->inNamespace()) {
87 87
             return $this->generateStub($classNode);
88 88
         }
89 89
 
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
 
135 135
     private function addClassModifiers(Class_ $classNode, CoreReflectionClass $classReflection) : void
136 136
     {
137
-        if (! $classReflection->isInterface() && $classReflection->isAbstract()) {
137
+        if (!$classReflection->isInterface() && $classReflection->isAbstract()) {
138 138
             // Interface \Iterator is interface and abstract
139 139
             $classNode->makeAbstract();
140 140
         }
141 141
 
142
-        if (! $classReflection->isFinal()) {
142
+        if (!$classReflection->isFinal()) {
143 143
             return;
144 144
         }
145 145
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         $defaultProperties = $classReflection->getDefaultProperties();
199 199
 
200 200
         foreach ($classReflection->getProperties() as $propertyReflection) {
201
-            if (! $this->isPropertyDeclaredInClass($propertyReflection, $classReflection)) {
201
+            if (!$this->isPropertyDeclaredInClass($propertyReflection, $classReflection)) {
202 202
                 continue;
203 203
             }
204 204
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
             $propertyNode->makeProtected();
245 245
         }
246 246
 
247
-        if (! $propertyReflection->isPrivate()) {
247
+        if (!$propertyReflection->isPrivate()) {
248 248
             return;
249 249
         }
250 250
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     private function addMethods(Declaration $classNode, CoreReflectionClass $classReflection) : void
288 288
     {
289 289
         foreach ($classReflection->getMethods() as $methodReflection) {
290
-            if (! $this->isMethodDeclaredInClass($methodReflection, $classReflection)) {
290
+            if (!$this->isMethodDeclaredInClass($methodReflection, $classReflection)) {
291 291
                 continue;
292 292
             }
293 293
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
             $methodNode->makePrivate();
353 353
         }
354 354
 
355
-        if (! $methodReflection->returnsReference()) {
355
+        if (!$methodReflection->returnsReference()) {
356 356
             return;
357 357
         }
358 358
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 
367 367
             $this->addParameterModifiers($parameterReflection, $parameterNode);
368 368
 
369
-            if ($parameterReflection->isOptional() && ! $parameterReflection->isVariadic()) {
369
+            if ($parameterReflection->isOptional() && !$parameterReflection->isVariadic()) {
370 370
                 $parameterNode->setDefault($this->parameterDefaultValue($parameterReflection, $functionReflectionAbstract));
371 371
             }
372 372
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
      */
413 413
     private function formatType(CoreReflectionType $type) : NodeAbstract
414 414
     {
415
-        $name     = (string) $type;
415
+        $name     = (string)$type;
416 416
         $nameNode = $type->isBuiltin() || in_array($name, ['self', 'parent'], true) ? new Name($name) : new FullyQualified($name);
417 417
 
418 418
         return $type->allowsNull() ? new NullableType($nameNode) : $nameNode;
@@ -420,6 +420,6 @@  discard block
 block discarded – undo
420 420
 
421 421
     private function generateStub(Builder $builder) : string
422 422
     {
423
-        return "<?php\n\n" . $this->prettyPrinter->prettyPrint([$builder->getNode()]) . "\n";
423
+        return "<?php\n\n".$this->prettyPrinter->prettyPrint([$builder->getNode()])."\n";
424 424
     }
425 425
 }
Please login to merge, or discard this patch.
src/SourceLocator/Type/ClosureSourceLocator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
     private function getReflectionFunction(Reflector $reflector, IdentifierType $identifierType) : ?ReflectionFunction
69 69
     {
70
-        if (! $identifierType->isFunction()) {
70
+        if (!$identifierType->isFunction()) {
71 71
             return null;
72 72
         }
73 73
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                     return null;
113 113
                 }
114 114
 
115
-                if (! ($node instanceof Node\Expr\Closure)) {
115
+                if (!($node instanceof Node\Expr\Closure)) {
116 116
                     return null;
117 117
                 }
118 118
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
              */
125 125
             public function leaveNode(Node $node)
126 126
             {
127
-                if (! ($node instanceof Namespace_)) {
127
+                if (!($node instanceof Namespace_)) {
128 128
                     return null;
129 129
                 }
130 130
 
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
             public function getClosureNodes() : ?array
140 140
             {
141 141
                 /** @var (Node|null)[][] $closureNodesDataOnSameLine */
142
-                $closureNodesDataOnSameLine = array_values(array_filter($this->closureNodes, function (array $nodes) : bool {
142
+                $closureNodesDataOnSameLine = array_values(array_filter($this->closureNodes, function(array $nodes) : bool {
143 143
                     return $nodes[0]->getLine() === $this->startLine;
144 144
                 }));
145 145
 
146
-                if (! $closureNodesDataOnSameLine) {
146
+                if (!$closureNodesDataOnSameLine) {
147 147
                     return null;
148 148
                 }
149 149
 
Please login to merge, or discard this patch.
src/SourceLocator/Type/AnonymousClassObjectSourceLocator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function __construct($anonymousClassObject, Parser $parser)
55 55
     {
56
-        if (! is_object($anonymousClassObject)) {
56
+        if (!is_object($anonymousClassObject)) {
57 57
             throw new InvalidArgumentException(sprintf(
58 58
                 'Can only create from an instance of an object, "%s" given',
59 59
                 gettype($anonymousClassObject)
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
     private function getReflectionClass(Reflector $reflector, IdentifierType $identifierType) : ?ReflectionClass
88 88
     {
89
-        if (! $identifierType->isClass()) {
89
+        if (!$identifierType->isClass()) {
90 90
             return null;
91 91
         }
92 92
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
              */
123 123
             public function enterNode(Node $node)
124 124
             {
125
-                if (! ($node instanceof Node\Stmt\Class_) || $node->name !== null) {
125
+                if (!($node instanceof Node\Stmt\Class_) || $node->name !== null) {
126 126
                     return null;
127 127
                 }
128 128
 
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
             public function getAnonymousClassNode() : ?Class_
133 133
             {
134 134
                 /** @var Class_[] $anonymousClassNodesOnSameLine */
135
-                $anonymousClassNodesOnSameLine = array_values(array_filter($this->anonymousClassNodes, function (Class_ $node) : bool {
135
+                $anonymousClassNodesOnSameLine = array_values(array_filter($this->anonymousClassNodes, function(Class_ $node) : bool {
136 136
                     return $node->getLine() === $this->startLine;
137 137
                 }));
138 138
 
139
-                if (! $anonymousClassNodesOnSameLine) {
139
+                if (!$anonymousClassNodesOnSameLine) {
140 140
                     return null;
141 141
                 }
142 142
 
Please login to merge, or discard this patch.
src/SourceLocator/Ast/FindReflectionsInTree.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
                     return null;
97 97
                 }
98 98
 
99
-                if (! ($node instanceof Node\Stmt\Function_)) {
99
+                if (!($node instanceof Node\Stmt\Function_)) {
100 100
                     return null;
101 101
                 }
102 102
 
103 103
                 $reflection = $this->astConversionStrategy->__invoke($this->reflector, $node, $this->locatedSource, $this->currentNamespace);
104 104
 
105
-                if (! $this->identifierType->isMatchingReflector($reflection)) {
105
+                if (!$this->identifierType->isMatchingReflector($reflection)) {
106 106
                     return null;
107 107
                 }
108 108
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
              */
115 115
             public function leaveNode(Node $node)
116 116
             {
117
-                if (! ($node instanceof Namespace_)) {
117
+                if (!($node instanceof Namespace_)) {
118 118
                     return null;
119 119
                 }
120 120
 
Please login to merge, or discard this patch.
src/Reflection/ReflectionProperty.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
         $stringTypes = [];
218 218
 
219 219
         foreach ($this->getDocBlockTypes() as $type) {
220
-            $stringTypes[] = (string) $type;
220
+            $stringTypes[] = (string)$type;
221 221
         }
222 222
 
223 223
         return $stringTypes;
@@ -334,14 +334,14 @@  discard block
 block discarded – undo
334 334
         if ($this->isStatic()) {
335 335
             $this->assertClassExist($declaringClassName);
336 336
 
337
-            return Closure::bind(function (string $declaringClassName, string $propertyName) {
337
+            return Closure::bind(function(string $declaringClassName, string $propertyName) {
338 338
                 return $declaringClassName::${$propertyName};
339 339
             }, null, $declaringClassName)->__invoke($declaringClassName, $this->getName());
340 340
         }
341 341
 
342 342
         $instance = $this->assertObject($object);
343 343
 
344
-        return Closure::bind(function ($instance, string $propertyName) {
344
+        return Closure::bind(function($instance, string $propertyName) {
345 345
             return $instance->{$propertyName};
346 346
         }, $instance, $declaringClassName)->__invoke($instance, $this->getName());
347 347
     }
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
         if ($this->isStatic()) {
363 363
             $this->assertClassExist($declaringClassName);
364 364
 
365
-            Closure::bind(function (string $declaringClassName, string $propertyName, $value) : void {
365
+            Closure::bind(function(string $declaringClassName, string $propertyName, $value) : void {
366 366
                 $declaringClassName::${$propertyName} = $value;
367 367
             }, null, $declaringClassName)->__invoke($declaringClassName, $this->getName(), func_num_args() === 2 ? $value : $object);
368 368
 
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 
372 372
         $instance = $this->assertObject($object);
373 373
 
374
-        Closure::bind(function ($instance, string $propertyName, $value) : void {
374
+        Closure::bind(function($instance, string $propertyName, $value) : void {
375 375
             $instance->{$propertyName} = $value;
376 376
         }, $instance, $declaringClassName)->__invoke($instance, $this->getName(), $value);
377 377
     }
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
      */
382 382
     private function assertClassExist(string $className) : void
383 383
     {
384
-        if (! class_exists($className, false)) {
384
+        if (!class_exists($className, false)) {
385 385
             throw new ClassDoesNotExist('Property cannot be retrieved as the class is not loaded');
386 386
         }
387 387
     }
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
             throw NoObjectProvided::create();
402 402
         }
403 403
 
404
-        if (! is_object($object)) {
404
+        if (!is_object($object)) {
405 405
             throw NotAnObject::fromNonObject($object);
406 406
         }
407 407
 
Please login to merge, or discard this patch.
src/Reflection/ReflectionParameter.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
     private function parseDefaultValueNode() : void
175 175
     {
176
-        if (! $this->isDefaultValueAvailable()) {
176
+        if (!$this->isDefaultValueAvailable()) {
177 177
             throw new LogicException('This parameter does not have a default value available');
178 178
         }
179 179
 
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 
192 192
             $this->isDefaultValueConstant = true;
193 193
             /** @var Node\Identifier $defaultValueNode->name */
194
-            $this->defaultValueConstantName = $className . '::' . $defaultValueNode->name->name;
194
+            $this->defaultValueConstantName = $className.'::'.$defaultValueNode->name->name;
195 195
         }
196 196
 
197 197
         if ($defaultValueNode instanceof Node\Expr\ConstFetch
198
-            && ! in_array(strtolower($defaultValueNode->name->parts[0]), ['true', 'false', 'null'], true)) {
198
+            && !in_array(strtolower($defaultValueNode->name->parts[0]), ['true', 'false', 'null'], true)) {
199 199
             $this->isDefaultValueConstant   = true;
200 200
             $this->defaultValueConstantName = $defaultValueNode->name->parts[0];
201 201
             $this->defaultValue             = null;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
      */
274 274
     public function isOptional() : bool
275 275
     {
276
-        return ((bool) $this->node->isOptional) || $this->isVariadic();
276
+        return ((bool)$this->node->isOptional) || $this->isVariadic();
277 277
     }
278 278
 
279 279
     /**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
      */
310 310
     public function allowsNull() : bool
311 311
     {
312
-        if (! $this->hasType()) {
312
+        if (!$this->hasType()) {
313 313
             return true;
314 314
         }
315 315
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
             return true;
318 318
         }
319 319
 
320
-        if (! $this->isDefaultValueAvailable()) {
320
+        if (!$this->isDefaultValueAvailable()) {
321 321
             return false;
322 322
         }
323 323
 
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
         $stringTypes = [];
335 335
 
336 336
         foreach ($this->getDocBlockTypes() as $type) {
337
-            $stringTypes[] = (string) $type;
337
+            $stringTypes[] = (string)$type;
338 338
         }
339 339
 
340 340
         return $stringTypes;
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
             $type = $type->type;
382 382
         }
383 383
 
384
-        return ReflectionType::createFromTypeAndReflector((string) $type, $this->allowsNull(), $this->reflector);
384
+        return ReflectionType::createFromTypeAndReflector((string)$type, $this->allowsNull(), $this->reflector);
385 385
     }
386 386
 
387 387
     /**
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
      */
416 416
     public function isArray() : bool
417 417
     {
418
-        return strtolower((string) $this->getType()) === 'array';
418
+        return strtolower((string)$this->getType()) === 'array';
419 419
     }
420 420
 
421 421
     /**
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
      */
424 424
     public function isCallable() : bool
425 425
     {
426
-        return strtolower((string) $this->getType()) === 'callable';
426
+        return strtolower((string)$this->getType()) === 'callable';
427 427
     }
428 428
 
429 429
     /**
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 
445 445
     public function canBePassedByValue() : bool
446 446
     {
447
-        return ! $this->isPassedByReference();
447
+        return !$this->isPassedByReference();
448 448
     }
449 449
 
450 450
     public function isDefaultValueConstant() : bool
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
     public function getDefaultValueConstantName() : string
461 461
     {
462 462
         $this->parseDefaultValueNode();
463
-        if (! $this->isDefaultValueConstant()) {
463
+        if (!$this->isDefaultValueConstant()) {
464 464
             throw new LogicException('This parameter is not a constant default value, so cannot have a constant name');
465 465
         }
466 466
 
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
             return null;
481 481
         }
482 482
 
483
-        if (! $this->reflector instanceof ClassReflector) {
483
+        if (!$this->reflector instanceof ClassReflector) {
484 484
             throw new RuntimeException(sprintf(
485 485
                 'Unable to reflect class type because we were not given a "%s", but a "%s" instead',
486 486
                 ClassReflector::class,
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
 
494 494
     private function getClassName() : ?string
495 495
     {
496
-        if (! $this->hasType()) {
496
+        if (!$this->hasType()) {
497 497
             return null;
498 498
         }
499 499
 
500 500
         /** @var ReflectionType $type */
501 501
         $type     = $this->getType();
502
-        $typeHint = (string) $type;
502
+        $typeHint = (string)$type;
503 503
 
504 504
         if ($typeHint === 'self') {
505 505
             /** @var ReflectionClass $declaringClass */
Please login to merge, or discard this patch.
src/Reflection/StringCast/ReflectionClassStringCast.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -99,22 +99,22 @@  discard block
 block discarded – undo
99 99
     {
100 100
         $parentClass = $classReflection->getParentClass();
101 101
 
102
-        if (! $parentClass) {
102
+        if (!$parentClass) {
103 103
             return '';
104 104
         }
105 105
 
106
-        return ' extends ' . $parentClass->getName();
106
+        return ' extends '.$parentClass->getName();
107 107
     }
108 108
 
109 109
     private static function implementsToString(ReflectionClass $classReflection) : string
110 110
     {
111 111
         $interfaceNames = $classReflection->getInterfaceNames();
112 112
 
113
-        if (! $interfaceNames) {
113
+        if (!$interfaceNames) {
114 114
             return '';
115 115
         }
116 116
 
117
-        return ' implements ' . implode(', ', $interfaceNames);
117
+        return ' implements '.implode(', ', $interfaceNames);
118 118
     }
119 119
 
120 120
     private static function fileAndLinesToString(ReflectionClass $classReflection) : string
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
      */
132 132
     private static function constantsToString(array $constants) : string
133 133
     {
134
-        if (! $constants) {
134
+        if (!$constants) {
135 135
             return '';
136 136
         }
137 137
 
138
-        return self::itemsToString(array_map(static function (ReflectionClassConstant $constantReflection) : string {
138
+        return self::itemsToString(array_map(static function(ReflectionClassConstant $constantReflection) : string {
139 139
             return trim(ReflectionClassConstantStringCast::toString($constantReflection));
140 140
         }, $constants));
141 141
     }
@@ -145,11 +145,11 @@  discard block
 block discarded – undo
145 145
      */
146 146
     private static function propertiesToString(array $properties) : string
147 147
     {
148
-        if (! $properties) {
148
+        if (!$properties) {
149 149
             return '';
150 150
         }
151 151
 
152
-        return self::itemsToString(array_map(static function (ReflectionProperty $propertyReflection) : string {
152
+        return self::itemsToString(array_map(static function(ReflectionProperty $propertyReflection) : string {
153 153
             return ReflectionPropertyStringCast::toString($propertyReflection);
154 154
         }, $properties));
155 155
     }
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
      */
160 160
     private static function methodsToString(ReflectionClass $classReflection, array $methods, int $emptyLinesAmongItems = 1) : string
161 161
     {
162
-        if (! $methods) {
162
+        if (!$methods) {
163 163
             return '';
164 164
         }
165 165
 
166
-        return self::itemsToString(array_map(static function (ReflectionMethod $method) use ($classReflection) : string {
166
+        return self::itemsToString(array_map(static function(ReflectionMethod $method) use ($classReflection) : string {
167 167
             return ReflectionMethodStringCast::toString($method, $classReflection);
168 168
         }, $methods), $emptyLinesAmongItems);
169 169
     }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     {
176 176
         $string = implode(str_repeat("\n", $emptyLinesAmongItems), $items);
177 177
 
178
-        return "\n" . preg_replace('/(^|\n)(?!\n)/', '\1' . self::indent(), $string);
178
+        return "\n".preg_replace('/(^|\n)(?!\n)/', '\1'.self::indent(), $string);
179 179
     }
180 180
 
181 181
     private static function indent() : string
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      */
189 189
     private static function getStaticProperties(ReflectionClass $classReflection) : array
190 190
     {
191
-        return array_filter($classReflection->getProperties(), static function (ReflectionProperty $propertyReflection) : bool {
191
+        return array_filter($classReflection->getProperties(), static function(ReflectionProperty $propertyReflection) : bool {
192 192
             return $propertyReflection->isStatic();
193 193
         });
194 194
     }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
      */
199 199
     private static function getStaticMethods(ReflectionClass $classReflection) : array
200 200
     {
201
-        return array_filter($classReflection->getMethods(), static function (ReflectionMethod $methodReflection) : bool {
201
+        return array_filter($classReflection->getMethods(), static function(ReflectionMethod $methodReflection) : bool {
202 202
             return $methodReflection->isStatic();
203 203
         });
204 204
     }
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
      */
209 209
     private static function getDefaultProperties(ReflectionClass $classReflection) : array
210 210
     {
211
-        return array_filter($classReflection->getProperties(), static function (ReflectionProperty $propertyReflection) : bool {
212
-            return ! $propertyReflection->isStatic() && $propertyReflection->isDefault();
211
+        return array_filter($classReflection->getProperties(), static function(ReflectionProperty $propertyReflection) : bool {
212
+            return !$propertyReflection->isStatic() && $propertyReflection->isDefault();
213 213
         });
214 214
     }
215 215
 
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
      */
219 219
     private static function getDynamicProperties(ReflectionClass $classReflection) : array
220 220
     {
221
-        return array_filter($classReflection->getProperties(), static function (ReflectionProperty $propertyReflection) : bool {
222
-            return ! $propertyReflection->isStatic() && ! $propertyReflection->isDefault();
221
+        return array_filter($classReflection->getProperties(), static function(ReflectionProperty $propertyReflection) : bool {
222
+            return !$propertyReflection->isStatic() && !$propertyReflection->isDefault();
223 223
         });
224 224
     }
225 225
 
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
      */
229 229
     private static function getMethods(ReflectionClass $classReflection) : array
230 230
     {
231
-        return array_filter($classReflection->getMethods(), static function (ReflectionMethod $methodReflection) : bool {
232
-            return ! $methodReflection->isStatic();
231
+        return array_filter($classReflection->getMethods(), static function(ReflectionMethod $methodReflection) : bool {
232
+            return !$methodReflection->isStatic();
233 233
         });
234 234
     }
235 235
 }
Please login to merge, or discard this patch.