@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getPropertyDocblockTypeHint(\ReflectionProperty $reflectionProperty): ?string |
59 | 59 | { |
60 | - if (!$reflectionProperty->getDocComment()) { |
|
60 | + if ( ! $reflectionProperty->getDocComment()) { |
|
61 | 61 | return null; |
62 | 62 | } |
63 | 63 | |
@@ -92,25 +92,25 @@ discard block |
||
92 | 92 | if ($type instanceof ArrayTypeNode) { |
93 | 93 | $resolvedType = $this->resolveTypeFromTypeNode($type->type, $reflectionProperty); |
94 | 94 | |
95 | - return 'array<' . $resolvedType . '>'; |
|
95 | + return 'array<'.$resolvedType.'>'; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | // Generic array syntax: array<Product> | array<\Foo\Bar\Product> | array<int,Product> |
99 | 99 | if ($type instanceof GenericTypeNode) { |
100 | 100 | if ($this->isSimpleType($type->type, 'array')) { |
101 | - $resolvedTypes = array_map(function (TypeNode $node) use ($reflectionProperty) { |
|
101 | + $resolvedTypes = array_map(function(TypeNode $node) use ($reflectionProperty) { |
|
102 | 102 | return $this->resolveTypeFromTypeNode($node, $reflectionProperty); |
103 | 103 | }, $type->genericTypes); |
104 | 104 | |
105 | - return 'array<' . implode(',', $resolvedTypes) . '>'; |
|
105 | + return 'array<'.implode(',', $resolvedTypes).'>'; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | if ($this->isSimpleType($type->type, 'list')) { |
109 | - $resolvedTypes = array_map(function (TypeNode $node) use ($reflectionProperty) { |
|
109 | + $resolvedTypes = array_map(function(TypeNode $node) use ($reflectionProperty) { |
|
110 | 110 | return $this->resolveTypeFromTypeNode($node, $reflectionProperty); |
111 | 111 | }, $type->genericTypes); |
112 | 112 | |
113 | - return 'array<int, ' . implode(',', $resolvedTypes) . '>'; |
|
113 | + return 'array<int, '.implode(',', $resolvedTypes).'>'; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | 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())); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | return []; |
134 | 134 | } |
135 | 135 | |
136 | - return array_merge(...array_map(static function (VarTagValueNode $node) { |
|
136 | + return array_merge(...array_map(static function(VarTagValueNode $node) { |
|
137 | 137 | if ($node->type instanceof UnionTypeNode) { |
138 | 138 | return $node->type->types; |
139 | 139 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | private function filterNullFromTypes(array $types): array |
153 | 153 | { |
154 | - return array_values(array_filter(array_map(function (TypeNode $node) { |
|
154 | + return array_values(array_filter(array_map(function(TypeNode $node) { |
|
155 | 155 | return $this->isNullType($node) ? null : $node; |
156 | 156 | }, $types))); |
157 | 157 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | private function resolveTypeFromTypeNode(TypeNode $typeNode, \ReflectionProperty $reflectionProperty): string |
196 | 196 | { |
197 | - if (!($typeNode instanceof IdentifierTypeNode)) { |
|
197 | + if ( ! ($typeNode instanceof IdentifierTypeNode)) { |
|
198 | 198 | throw new \InvalidArgumentException(sprintf("Can't use unsupported type %s for collection in %s:%s", (string) $typeNode, $reflectionProperty->getDeclaringClass()->getName(), $reflectionProperty->getName())); |
199 | 199 | } |
200 | 200 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | return $typeHint; |
208 | 208 | } |
209 | 209 | |
210 | - $expandedClassName = $declaringClass->getNamespaceName() . '\\' . $typeHint; |
|
210 | + $expandedClassName = $declaringClass->getNamespaceName().'\\'.$typeHint; |
|
211 | 211 | if ($this->isClassOrInterface($expandedClassName)) { |
212 | 212 | return $expandedClassName; |
213 | 213 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | preg_match_all(self::PHPSTAN_ARRAY_SHAPE, $declaringClass->getDocComment(), $foundPhpstanArrayShape); |
232 | - $phpstanArrayShapes = array_map(static function (string $phpstanArrayType) { |
|
232 | + $phpstanArrayShapes = array_map(static function(string $phpstanArrayType) { |
|
233 | 233 | return $phpstanArrayType; |
234 | 234 | }, $foundPhpstanArrayShape[1]); |
235 | 235 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | private function endsWith(string $statementClassToCheck, string $typeHintToSearchFor): bool |
244 | 244 | { |
245 | - $typeHintToSearchFor = '\\' . $typeHintToSearchFor; |
|
245 | + $typeHintToSearchFor = '\\'.$typeHintToSearchFor; |
|
246 | 246 | |
247 | 247 | return substr($statementClassToCheck, -strlen($typeHintToSearchFor)) === $typeHintToSearchFor; |
248 | 248 | } |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | preg_match_all(self::GROUP_USE_STATEMENTS_REGEX, $classContents, $foundGroupUseStatements); |
264 | 264 | for ($useStatementIndex = 0; $useStatementIndex < count($foundGroupUseStatements[0]); $useStatementIndex++) { |
265 | 265 | foreach (explode(',', $foundGroupUseStatements[2][$useStatementIndex]) as $singleUseStatement) { |
266 | - $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]) . trim($singleUseStatement); |
|
266 | + $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]).trim($singleUseStatement); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | |
297 | 297 | private function resolveType(string $typeHint, \ReflectionProperty $reflectionProperty): string |
298 | 298 | { |
299 | - if (!$this->hasGlobalNamespacePrefix($typeHint) && !$this->isPrimitiveType($typeHint)) { |
|
299 | + if ( ! $this->hasGlobalNamespacePrefix($typeHint) && ! $this->isPrimitiveType($typeHint)) { |
|
300 | 300 | $typeHint = $this->expandClassNameUsingUseStatements($typeHint, $this->getDeclaringClassOrTrait($reflectionProperty), $reflectionProperty); |
301 | 301 | } |
302 | 302 |