Passed
Pull Request — master (#1552)
by
unknown
04:04
created
src/Metadata/Driver/DocBlockDriver/DocBlockTypeResolver.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
         if ($type instanceof ArrayTypeNode) {
129 129
             $resolvedType = $this->resolveTypeFromTypeNode($type->type, $reflector);
130 130
 
131
-            return 'array<' . $resolvedType . '>';
131
+            return 'array<'.$resolvedType.'>';
132 132
         }
133 133
 
134 134
         // Generic array syntax: array<Product> | array<\Foo\Bar\Product> | array<int,Product>
135 135
         if ($type instanceof GenericTypeNode) {
136 136
             $isSimpleTypeArray = $this->isSimpleType($type->type, 'array');
137 137
             $isSimpleTypeList = $this->isSimpleType($type->type, 'list');
138
-            if (!$isSimpleTypeArray && !$isSimpleTypeList) {
138
+            if ( ! $isSimpleTypeArray && ! $isSimpleTypeList) {
139 139
                 throw new \InvalidArgumentException(sprintf("Can't use non-array generic type %s for collection in %s:%s", (string) $type->type, $reflector->getDeclaringClass()->getName(), $reflector->getName()));
140 140
             }
141 141
 
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 
155 155
             if ($type->genericTypes[$valuesIndex] instanceof UnionTypeNode) {
156 156
                 $valueTypes = array_map(
157
-                    function (TypeNode $node) use ($reflector) {
157
+                    function(TypeNode $node) use ($reflector) {
158 158
                         if ($node instanceof ArrayTypeNode) {
159 159
                             $resolvedType = $this->resolveTypeFromTypeNode($node->type, $reflector);
160 160
 
161
-                            return 'array<' . $resolvedType . '>';
161
+                            return 'array<'.$resolvedType.'>';
162 162
                         }
163 163
 
164 164
                         return $this->resolveTypeFromTypeNode($node, $reflector);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             return [];
197 197
         }
198 198
 
199
-        return array_merge(...array_map(static function ($node) {
199
+        return array_merge(...array_map(static function($node) {
200 200
             if ($node->type instanceof UnionTypeNode) {
201 201
                 return $node->type->types;
202 202
             }
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      */
282 282
     private function resolveTypeFromTypeNode(TypeNode $typeNode, $reflector): string
283 283
     {
284
-        if (!($typeNode instanceof IdentifierTypeNode)) {
284
+        if ( ! ($typeNode instanceof IdentifierTypeNode)) {
285 285
             throw new \InvalidArgumentException(sprintf("Can't use unsupported type %s for collection in %s:%s", (string) $typeNode, $reflector->getDeclaringClass()->getName(), $reflector->getName()));
286 286
         }
287 287
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
      */
294 294
     private function expandClassNameUsingUseStatements(string $typeHint, \ReflectionClass $declaringClass, $reflector): string
295 295
     {
296
-        $expandedClassName = $declaringClass->getNamespaceName() . '\\' . $typeHint;
296
+        $expandedClassName = $declaringClass->getNamespaceName().'\\'.$typeHint;
297 297
         if ($this->isClassOrInterface($expandedClassName)) {
298 298
             return $expandedClassName;
299 299
         }
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 
332 332
     private function endsWith(string $statementClassToCheck, string $typeHintToSearchFor): bool
333 333
     {
334
-        $typeHintToSearchFor = '\\' . $typeHintToSearchFor;
334
+        $typeHintToSearchFor = '\\'.$typeHintToSearchFor;
335 335
 
336 336
         return substr($statementClassToCheck, -strlen($typeHintToSearchFor)) === $typeHintToSearchFor;
337 337
     }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
         preg_match_all(self::GROUP_USE_STATEMENTS_REGEX, $classContents, $foundGroupUseStatements);
353 353
         for ($useStatementIndex = 0; $useStatementIndex < count($foundGroupUseStatements[0]); $useStatementIndex++) {
354 354
             foreach (explode(',', $foundGroupUseStatements[2][$useStatementIndex]) as $singleUseStatement) {
355
-                $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]) . trim($singleUseStatement);
355
+                $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]).trim($singleUseStatement);
356 356
             }
357 357
         }
358 358
 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
      */
392 392
     private function resolveType(string $typeHint, $reflector): string
393 393
     {
394
-        if (!$this->hasGlobalNamespacePrefix($typeHint) && !$this->isPrimitiveType($typeHint)) {
394
+        if ( ! $this->hasGlobalNamespacePrefix($typeHint) && ! $this->isPrimitiveType($typeHint)) {
395 395
             $typeHint = $this->expandClassNameUsingUseStatements($typeHint, $this->getDeclaringClassOrTrait($reflector), $reflector);
396 396
         }
397 397
 
@@ -409,15 +409,15 @@  discard block
 block discarded – undo
409 409
     private function resolveTypeFromDocblock($reflector): array
410 410
     {
411 411
         $docComment = $reflector->getDocComment();
412
-        if (!$docComment && PHP_VERSION_ID >= 80000 && $reflector instanceof \ReflectionProperty && $reflector->isPromoted()) {
412
+        if ( ! $docComment && PHP_VERSION_ID >= 80000 && $reflector instanceof \ReflectionProperty && $reflector->isPromoted()) {
413 413
             $constructor = $reflector->getDeclaringClass()->getConstructor();
414
-            if (!$constructor) {
414
+            if ( ! $constructor) {
415 415
                 return [];
416 416
             }
417 417
 
418 418
             $docComment = $constructor->getDocComment();
419 419
 
420
-            if (!$docComment) {
420
+            if ( ! $docComment) {
421 421
                 return [];
422 422
             }
423 423
 
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
             return $this->flattenParamTagValueTypes($reflector->getName(), $phpDocNode->getParamTagValues());
428 428
         }
429 429
 
430
-        if (!$docComment) {
430
+        if ( ! $docComment) {
431 431
             return [];
432 432
         }
433 433
 
Please login to merge, or discard this patch.