Passed
Pull Request — master (#1552)
by
unknown
02:44
created
src/Metadata/Driver/DocBlockDriver/DocBlockTypeResolver.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
         if ($type instanceof ArrayTypeNode) {
112 112
             $resolvedType = $this->resolveTypeFromTypeNode($type->type, $reflector);
113 113
 
114
-            return 'array<' . $resolvedType . '>';
114
+            return 'array<'.$resolvedType.'>';
115 115
         }
116 116
 
117 117
         // Generic array syntax: array<Product> | array<\Foo\Bar\Product> | array<int,Product>
118 118
         if ($type instanceof GenericTypeNode) {
119 119
             $isSimpleTypeArray = $this->isSimpleType($type->type, 'array');
120 120
             $isSimpleTypeList = $this->isSimpleType($type->type, 'list');
121
-            if (!$isSimpleTypeArray && !$isSimpleTypeList) {
121
+            if ( ! $isSimpleTypeArray && ! $isSimpleTypeList) {
122 122
                 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()));
123 123
             }
124 124
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             return [];
170 170
         }
171 171
 
172
-        return array_merge(...array_map(static function ($node) {
172
+        return array_merge(...array_map(static function($node) {
173 173
             if ($node->type instanceof UnionTypeNode) {
174 174
                 return $node->type->types;
175 175
             }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
      */
255 255
     private function resolveTypeFromTypeNode(TypeNode $typeNode, $reflector): string
256 256
     {
257
-        if (!($typeNode instanceof IdentifierTypeNode)) {
257
+        if ( ! ($typeNode instanceof IdentifierTypeNode)) {
258 258
             throw new \InvalidArgumentException(sprintf("Can't use unsupported type %s for collection in %s:%s", (string) $typeNode, $reflector->getDeclaringClass()->getName(), $reflector->getName()));
259 259
         }
260 260
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
      */
267 267
     private function expandClassNameUsingUseStatements(string $typeHint, \ReflectionClass $declaringClass, $reflector): string
268 268
     {
269
-        $expandedClassName = $declaringClass->getNamespaceName() . '\\' . $typeHint;
269
+        $expandedClassName = $declaringClass->getNamespaceName().'\\'.$typeHint;
270 270
         if ($this->isClassOrInterface($expandedClassName)) {
271 271
             return $expandedClassName;
272 272
         }
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 
305 305
     private function endsWith(string $statementClassToCheck, string $typeHintToSearchFor): bool
306 306
     {
307
-        $typeHintToSearchFor = '\\' . $typeHintToSearchFor;
307
+        $typeHintToSearchFor = '\\'.$typeHintToSearchFor;
308 308
 
309 309
         return substr($statementClassToCheck, -strlen($typeHintToSearchFor)) === $typeHintToSearchFor;
310 310
     }
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
         preg_match_all(self::GROUP_USE_STATEMENTS_REGEX, $classContents, $foundGroupUseStatements);
326 326
         for ($useStatementIndex = 0; $useStatementIndex < count($foundGroupUseStatements[0]); $useStatementIndex++) {
327 327
             foreach (explode(',', $foundGroupUseStatements[2][$useStatementIndex]) as $singleUseStatement) {
328
-                $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]) . trim($singleUseStatement);
328
+                $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]).trim($singleUseStatement);
329 329
             }
330 330
         }
331 331
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
      */
365 365
     private function resolveType(string $typeHint, $reflector): string
366 366
     {
367
-        if (!$this->hasGlobalNamespacePrefix($typeHint) && !$this->isPrimitiveType($typeHint)) {
367
+        if ( ! $this->hasGlobalNamespacePrefix($typeHint) && ! $this->isPrimitiveType($typeHint)) {
368 368
             $typeHint = $this->expandClassNameUsingUseStatements($typeHint, $this->getDeclaringClassOrTrait($reflector), $reflector);
369 369
         }
370 370
 
@@ -382,15 +382,15 @@  discard block
 block discarded – undo
382 382
     private function resolveTypeFromDocblock($reflector): array
383 383
     {
384 384
         $docComment = $reflector->getDocComment();
385
-        if (!$docComment && PHP_VERSION_ID >= 80000 && $reflector instanceof \ReflectionProperty && $reflector->isPromoted()) {
385
+        if ( ! $docComment && PHP_VERSION_ID >= 80000 && $reflector instanceof \ReflectionProperty && $reflector->isPromoted()) {
386 386
             $constructor = $reflector->getDeclaringClass()->getConstructor();
387
-            if (!$constructor) {
387
+            if ( ! $constructor) {
388 388
                 return [];
389 389
             }
390 390
 
391 391
             $docComment = $constructor->getDocComment();
392 392
 
393
-            if (!$docComment) {
393
+            if ( ! $docComment) {
394 394
                 return [];
395 395
             }
396 396
 
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
             return $this->flattenParamTagValueTypes($reflector->getName(), $phpDocNode->getParamTagValues());
401 401
         }
402 402
 
403
-        if (!$docComment) {
403
+        if ( ! $docComment) {
404 404
             return [];
405 405
         }
406 406
 
Please login to merge, or discard this patch.