@@ -56,7 +56,7 @@ discard block |
||
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,20 +91,20 @@ discard block |
||
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 | - if (!$this->isSimpleType($type->type, 'array')) { |
|
99 | + if ( ! $this->isSimpleType($type->type, 'array')) { |
|
100 | 100 | 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())); |
101 | 101 | } |
102 | 102 | |
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 | // Primitives and class names: Collection | \Foo\Bar\Product | string |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | return []; |
125 | 125 | } |
126 | 126 | |
127 | - return array_merge(...array_map(static function (VarTagValueNode $node) { |
|
127 | + return array_merge(...array_map(static function(VarTagValueNode $node) { |
|
128 | 128 | if ($node->type instanceof UnionTypeNode) { |
129 | 129 | return $node->type->types; |
130 | 130 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | private function filterNullFromTypes(array $types): array |
144 | 144 | { |
145 | - return array_values(array_filter(array_map(function (TypeNode $node) { |
|
145 | + return array_values(array_filter(array_map(function(TypeNode $node) { |
|
146 | 146 | return $this->isNullType($node) ? null : $node; |
147 | 147 | }, $types))); |
148 | 148 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | private function resolveTypeFromTypeNode(TypeNode $typeNode, \ReflectionProperty $reflectionProperty): string |
187 | 187 | { |
188 | - if (!($typeNode instanceof IdentifierTypeNode)) { |
|
188 | + if ( ! ($typeNode instanceof IdentifierTypeNode)) { |
|
189 | 189 | throw new \InvalidArgumentException(sprintf("Can't use unsupported type %s for collection in %s:%s", (string) $typeNode, $reflectionProperty->getDeclaringClass()->getName(), $reflectionProperty->getName())); |
190 | 190 | } |
191 | 191 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | return $typeHint; |
199 | 199 | } |
200 | 200 | |
201 | - $expandedClassName = $declaringClass->getNamespaceName() . '\\' . $typeHint; |
|
201 | + $expandedClassName = $declaringClass->getNamespaceName().'\\'.$typeHint; |
|
202 | 202 | if ($this->isClassOrInterface($expandedClassName)) { |
203 | 203 | return $expandedClassName; |
204 | 204 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | private function endsWith(string $statementClassToCheck, string $typeHintToSearchFor): bool |
226 | 226 | { |
227 | - $typeHintToSearchFor = '\\' . $typeHintToSearchFor; |
|
227 | + $typeHintToSearchFor = '\\'.$typeHintToSearchFor; |
|
228 | 228 | |
229 | 229 | return substr($statementClassToCheck, -strlen($typeHintToSearchFor)) === $typeHintToSearchFor; |
230 | 230 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | preg_match_all(self::GROUP_USE_STATEMENTS_REGEX, $classContents, $foundGroupUseStatements); |
246 | 246 | for ($useStatementIndex = 0; $useStatementIndex < count($foundGroupUseStatements[0]); $useStatementIndex++) { |
247 | 247 | foreach (explode(',', $foundGroupUseStatements[2][$useStatementIndex]) as $singleUseStatement) { |
248 | - $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]) . trim($singleUseStatement); |
|
248 | + $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]).trim($singleUseStatement); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | private function resolveType(string $typeHint, \ReflectionProperty $reflectionProperty): string |
280 | 280 | { |
281 | - if (!$this->hasGlobalNamespacePrefix($typeHint) && !$this->isPrimitiveType($typeHint)) { |
|
281 | + if ( ! $this->hasGlobalNamespacePrefix($typeHint) && ! $this->isPrimitiveType($typeHint)) { |
|
282 | 282 | $typeHint = $this->expandClassNameUsingUseStatements($typeHint, $this->getDeclaringClassOrTrait($reflectionProperty), $reflectionProperty); |
283 | 283 | } |
284 | 284 |