Passed
Pull Request — master (#1449)
by
unknown
08:56 queued 06:42
created
src/Metadata/Driver/DocBlockDriver/DocBlockTypeResolver.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function getPropertyDocblockTypeHint(\ReflectionProperty $reflectionProperty): ?string
61 61
     {
62
-        if (!$reflectionProperty->getDocComment()) {
62
+        if ( ! $reflectionProperty->getDocComment()) {
63 63
             return null;
64 64
         }
65 65
 
@@ -94,25 +94,25 @@  discard block
 block discarded – undo
94 94
         if ($type instanceof ArrayTypeNode) {
95 95
             $resolvedType = $this->resolveTypeFromTypeNode($type->type, $reflectionProperty);
96 96
 
97
-            return 'array<' . $resolvedType . '>';
97
+            return 'array<'.$resolvedType.'>';
98 98
         }
99 99
 
100 100
         // Generic array syntax: array<Product> | array<\Foo\Bar\Product> | array<int,Product>
101 101
         if ($type instanceof GenericTypeNode) {
102 102
             if ($this->isSimpleType($type->type, 'array')) {
103
-                $resolvedTypes = array_map(function (TypeNode $node) use ($reflectionProperty) {
103
+                $resolvedTypes = array_map(function(TypeNode $node) use ($reflectionProperty) {
104 104
                     return $this->resolveTypeFromTypeNode($node, $reflectionProperty);
105 105
                 }, $type->genericTypes);
106 106
 
107
-                return 'array<' . implode(',', $resolvedTypes) . '>';
107
+                return 'array<'.implode(',', $resolvedTypes).'>';
108 108
             }
109 109
 
110 110
             if ($this->isSimpleType($type->type, 'list')) {
111
-                $resolvedTypes = array_map(function (TypeNode $node) use ($reflectionProperty) {
111
+                $resolvedTypes = array_map(function(TypeNode $node) use ($reflectionProperty) {
112 112
                     return $this->resolveTypeFromTypeNode($node, $reflectionProperty);
113 113
                 }, $type->genericTypes);
114 114
 
115
-                return 'array<int, ' . implode(',', $resolvedTypes) . '>';
115
+                return 'array<int, '.implode(',', $resolvedTypes).'>';
116 116
             }
117 117
 
118 118
             throw new \InvalidArgumentException(sprintf("Can't use non-array generic type %s for collection in %s:%s", (string) $type->type, $reflectionProperty->getDeclaringClass()->getName(), $reflectionProperty->getName()));
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             return [];
136 136
         }
137 137
 
138
-        return array_merge(...array_map(static function (VarTagValueNode $node) {
138
+        return array_merge(...array_map(static function(VarTagValueNode $node) {
139 139
             if ($node->type instanceof UnionTypeNode) {
140 140
                 return $node->type->types;
141 141
             }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
      */
154 154
     private function filterNullFromTypes(array $types): array
155 155
     {
156
-        return array_values(array_filter(array_map(function (TypeNode $node) {
156
+        return array_values(array_filter(array_map(function(TypeNode $node) {
157 157
             return $this->isNullType($node) ? null : $node;
158 158
         }, $types)));
159 159
     }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      */
197 197
     private function resolveTypeFromTypeNode(TypeNode $typeNode, \ReflectionProperty $reflectionProperty): string
198 198
     {
199
-        if (!($typeNode instanceof IdentifierTypeNode)) {
199
+        if ( ! ($typeNode instanceof IdentifierTypeNode)) {
200 200
             throw new \InvalidArgumentException(sprintf("Can't use unsupported type %s for collection in %s:%s", (string) $typeNode, $reflectionProperty->getDeclaringClass()->getName(), $reflectionProperty->getName()));
201 201
         }
202 202
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
             return $typeHint;
210 210
         }
211 211
 
212
-        $expandedClassName = $declaringClass->getNamespaceName() . '\\' . $typeHint;
212
+        $expandedClassName = $declaringClass->getNamespaceName().'\\'.$typeHint;
213 213
         if ($this->isClassOrInterface($expandedClassName)) {
214 214
             return $expandedClassName;
215 215
         }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 
244 244
     private function endsWith(string $statementClassToCheck, string $typeHintToSearchFor): bool
245 245
     {
246
-        $typeHintToSearchFor = '\\' . $typeHintToSearchFor;
246
+        $typeHintToSearchFor = '\\'.$typeHintToSearchFor;
247 247
 
248 248
         return substr($statementClassToCheck, -strlen($typeHintToSearchFor)) === $typeHintToSearchFor;
249 249
     }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         preg_match_all(self::GROUP_USE_STATEMENTS_REGEX, $classContents, $foundGroupUseStatements);
265 265
         for ($useStatementIndex = 0; $useStatementIndex < count($foundGroupUseStatements[0]); $useStatementIndex++) {
266 266
             foreach (explode(',', $foundGroupUseStatements[2][$useStatementIndex]) as $singleUseStatement) {
267
-                $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]) . trim($singleUseStatement);
267
+                $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]).trim($singleUseStatement);
268 268
             }
269 269
         }
270 270
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
     private function resolveType(string $typeHint, \ReflectionProperty $reflectionProperty): string
299 299
     {
300
-        if (!$this->hasGlobalNamespacePrefix($typeHint) && !$this->isPrimitiveType($typeHint)) {
300
+        if ( ! $this->hasGlobalNamespacePrefix($typeHint) && ! $this->isPrimitiveType($typeHint)) {
301 301
             $typeHint = $this->expandClassNameUsingUseStatements($typeHint, $this->getDeclaringClassOrTrait($reflectionProperty), $reflectionProperty);
302 302
         }
303 303
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 
330 330
                     return sprintf('array<%s>', implode(
331 331
                         ',',
332
-                        array_map(static function (string $type) use ($reflectionProperty, $self) {
332
+                        array_map(static function(string $type) use ($reflectionProperty, $self) {
333 333
                             return $self->resolveType(trim($type), $reflectionProperty);
334 334
                         }, $types)
335 335
                     ));
Please login to merge, or discard this patch.