Passed
Push — master ( 162d0e...c4599e )
by Asmir
07:20 queued 04:56
created
src/Metadata/Driver/DocBlockDriver/DocBlockTypeResolver.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function getPropertyDocblockTypeHint(\ReflectionProperty $reflectionProperty): ?string
58 58
     {
59
-        if (!$reflectionProperty->getDocComment()) {
59
+        if ( ! $reflectionProperty->getDocComment()) {
60 60
             return null;
61 61
         }
62 62
 
@@ -91,25 +91,25 @@  discard block
 block discarded – undo
91 91
         if ($type instanceof ArrayTypeNode) {
92 92
             $resolvedType = $this->resolveTypeFromTypeNode($type->type, $reflectionProperty);
93 93
 
94
-            return 'array<' . $resolvedType . '>';
94
+            return 'array<'.$resolvedType.'>';
95 95
         }
96 96
 
97 97
         // Generic array syntax: array<Product> | array<\Foo\Bar\Product> | array<int,Product>
98 98
         if ($type instanceof GenericTypeNode) {
99 99
             if ($this->isSimpleType($type->type, 'array')) {
100
-                $resolvedTypes = array_map(function (TypeNode $node) use ($reflectionProperty) {
100
+                $resolvedTypes = array_map(function(TypeNode $node) use ($reflectionProperty) {
101 101
                     return $this->resolveTypeFromTypeNode($node, $reflectionProperty);
102 102
                 }, $type->genericTypes);
103 103
 
104
-                return 'array<' . implode(',', $resolvedTypes) . '>';
104
+                return 'array<'.implode(',', $resolvedTypes).'>';
105 105
             }
106 106
 
107 107
             if ($this->isSimpleType($type->type, 'list')) {
108
-                $resolvedTypes = array_map(function (TypeNode $node) use ($reflectionProperty) {
108
+                $resolvedTypes = array_map(function(TypeNode $node) use ($reflectionProperty) {
109 109
                     return $this->resolveTypeFromTypeNode($node, $reflectionProperty);
110 110
                 }, $type->genericTypes);
111 111
 
112
-                return 'array<int, ' . implode(',', $resolvedTypes) . '>';
112
+                return 'array<int, '.implode(',', $resolvedTypes).'>';
113 113
             }
114 114
 
115 115
             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()));
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             return [];
133 133
         }
134 134
 
135
-        return array_merge(...array_map(static function (VarTagValueNode $node) {
135
+        return array_merge(...array_map(static function(VarTagValueNode $node) {
136 136
             if ($node->type instanceof UnionTypeNode) {
137 137
                 return $node->type->types;
138 138
             }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     private function filterNullFromTypes(array $types): array
152 152
     {
153
-        return array_values(array_filter(array_map(function (TypeNode $node) {
153
+        return array_values(array_filter(array_map(function(TypeNode $node) {
154 154
             return $this->isNullType($node) ? null : $node;
155 155
         }, $types)));
156 156
     }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      */
194 194
     private function resolveTypeFromTypeNode(TypeNode $typeNode, \ReflectionProperty $reflectionProperty): string
195 195
     {
196
-        if (!($typeNode instanceof IdentifierTypeNode)) {
196
+        if ( ! ($typeNode instanceof IdentifierTypeNode)) {
197 197
             throw new \InvalidArgumentException(sprintf("Can't use unsupported type %s for collection in %s:%s", (string) $typeNode, $reflectionProperty->getDeclaringClass()->getName(), $reflectionProperty->getName()));
198 198
         }
199 199
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
             return $typeHint;
207 207
         }
208 208
 
209
-        $expandedClassName = $declaringClass->getNamespaceName() . '\\' . $typeHint;
209
+        $expandedClassName = $declaringClass->getNamespaceName().'\\'.$typeHint;
210 210
         if ($this->isClassOrInterface($expandedClassName)) {
211 211
             return $expandedClassName;
212 212
         }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 
233 233
     private function endsWith(string $statementClassToCheck, string $typeHintToSearchFor): bool
234 234
     {
235
-        $typeHintToSearchFor = '\\' . $typeHintToSearchFor;
235
+        $typeHintToSearchFor = '\\'.$typeHintToSearchFor;
236 236
 
237 237
         return substr($statementClassToCheck, -strlen($typeHintToSearchFor)) === $typeHintToSearchFor;
238 238
     }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         preg_match_all(self::GROUP_USE_STATEMENTS_REGEX, $classContents, $foundGroupUseStatements);
254 254
         for ($useStatementIndex = 0; $useStatementIndex < count($foundGroupUseStatements[0]); $useStatementIndex++) {
255 255
             foreach (explode(',', $foundGroupUseStatements[2][$useStatementIndex]) as $singleUseStatement) {
256
-                $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]) . trim($singleUseStatement);
256
+                $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]).trim($singleUseStatement);
257 257
             }
258 258
         }
259 259
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
     private function resolveType(string $typeHint, \ReflectionProperty $reflectionProperty): string
288 288
     {
289
-        if (!$this->hasGlobalNamespacePrefix($typeHint) && !$this->isPrimitiveType($typeHint)) {
289
+        if ( ! $this->hasGlobalNamespacePrefix($typeHint) && ! $this->isPrimitiveType($typeHint)) {
290 290
             $typeHint = $this->expandClassNameUsingUseStatements($typeHint, $this->getDeclaringClassOrTrait($reflectionProperty), $reflectionProperty);
291 291
         }
292 292
 
Please login to merge, or discard this patch.