@@ -109,25 +109,25 @@ discard block |
||
| 109 | 109 | if ($type instanceof ArrayTypeNode) { |
| 110 | 110 | $resolvedType = $this->resolveTypeFromTypeNode($type->type, $reflector); |
| 111 | 111 | |
| 112 | - return 'array<' . $resolvedType . '>'; |
|
| 112 | + return 'array<'.$resolvedType.'>'; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // Generic array syntax: array<Product> | array<\Foo\Bar\Product> | array<int,Product> |
| 116 | 116 | if ($type instanceof GenericTypeNode) { |
| 117 | 117 | if ($this->isSimpleType($type->type, 'array')) { |
| 118 | - $resolvedTypes = array_map(function (TypeNode $node) use ($reflector) { |
|
| 118 | + $resolvedTypes = array_map(function(TypeNode $node) use ($reflector) { |
|
| 119 | 119 | return $this->resolveTypeFromTypeNode($node, $reflector); |
| 120 | 120 | }, $type->genericTypes); |
| 121 | 121 | |
| 122 | - return 'array<' . implode(',', $resolvedTypes) . '>'; |
|
| 122 | + return 'array<'.implode(',', $resolvedTypes).'>'; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if ($this->isSimpleType($type->type, 'list')) { |
| 126 | - $resolvedTypes = array_map(function (TypeNode $node) use ($reflector) { |
|
| 126 | + $resolvedTypes = array_map(function(TypeNode $node) use ($reflector) { |
|
| 127 | 127 | return $this->resolveTypeFromTypeNode($node, $reflector); |
| 128 | 128 | }, $type->genericTypes); |
| 129 | 129 | |
| 130 | - return 'array<int, ' . implode(',', $resolvedTypes) . '>'; |
|
| 130 | + return 'array<int, '.implode(',', $resolvedTypes).'>'; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | 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())); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | return []; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - return array_merge(...array_map(static function ($node) { |
|
| 153 | + return array_merge(...array_map(static function($node) { |
|
| 154 | 154 | if ($node->type instanceof UnionTypeNode) { |
| 155 | 155 | return $node->type->types; |
| 156 | 156 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | private function filterNullFromTypes(array $types): array |
| 196 | 196 | { |
| 197 | - return array_values(array_filter(array_map(function (TypeNode $node) { |
|
| 197 | + return array_values(array_filter(array_map(function(TypeNode $node) { |
|
| 198 | 198 | return $this->isNullType($node) ? null : $node; |
| 199 | 199 | }, $types))); |
| 200 | 200 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | private function resolveTypeFromTypeNode(TypeNode $typeNode, $reflector): string |
| 239 | 239 | { |
| 240 | - if (!($typeNode instanceof IdentifierTypeNode)) { |
|
| 240 | + if ( ! ($typeNode instanceof IdentifierTypeNode)) { |
|
| 241 | 241 | throw new \InvalidArgumentException(sprintf("Can't use unsupported type %s for collection in %s:%s", (string) $typeNode, $reflector->getDeclaringClass()->getName(), $reflector->getName())); |
| 242 | 242 | } |
| 243 | 243 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | private function expandClassNameUsingUseStatements(string $typeHint, \ReflectionClass $declaringClass, $reflector): string |
| 251 | 251 | { |
| 252 | - $expandedClassName = $declaringClass->getNamespaceName() . '\\' . $typeHint; |
|
| 252 | + $expandedClassName = $declaringClass->getNamespaceName().'\\'.$typeHint; |
|
| 253 | 253 | if ($this->isClassOrInterface($expandedClassName)) { |
| 254 | 254 | return $expandedClassName; |
| 255 | 255 | } |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | |
| 288 | 288 | private function endsWith(string $statementClassToCheck, string $typeHintToSearchFor): bool |
| 289 | 289 | { |
| 290 | - $typeHintToSearchFor = '\\' . $typeHintToSearchFor; |
|
| 290 | + $typeHintToSearchFor = '\\'.$typeHintToSearchFor; |
|
| 291 | 291 | |
| 292 | 292 | return substr($statementClassToCheck, -strlen($typeHintToSearchFor)) === $typeHintToSearchFor; |
| 293 | 293 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | preg_match_all(self::GROUP_USE_STATEMENTS_REGEX, $classContents, $foundGroupUseStatements); |
| 309 | 309 | for ($useStatementIndex = 0; $useStatementIndex < count($foundGroupUseStatements[0]); $useStatementIndex++) { |
| 310 | 310 | foreach (explode(',', $foundGroupUseStatements[2][$useStatementIndex]) as $singleUseStatement) { |
| 311 | - $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]) . trim($singleUseStatement); |
|
| 311 | + $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]).trim($singleUseStatement); |
|
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | */ |
| 348 | 348 | private function resolveType(string $typeHint, $reflector): string |
| 349 | 349 | { |
| 350 | - if (!$this->hasGlobalNamespacePrefix($typeHint) && !$this->isPrimitiveType($typeHint)) { |
|
| 350 | + if ( ! $this->hasGlobalNamespacePrefix($typeHint) && ! $this->isPrimitiveType($typeHint)) { |
|
| 351 | 351 | $typeHint = $this->expandClassNameUsingUseStatements($typeHint, $this->getDeclaringClassOrTrait($reflector), $reflector); |
| 352 | 352 | } |
| 353 | 353 | |
@@ -365,15 +365,15 @@ discard block |
||
| 365 | 365 | private function resolveTypeFromDocblock($reflector): array |
| 366 | 366 | { |
| 367 | 367 | $docComment = $reflector->getDocComment(); |
| 368 | - if (!$docComment && PHP_VERSION_ID >= 80000 && $reflector instanceof \ReflectionProperty && $reflector->isPromoted()) { |
|
| 368 | + if ( ! $docComment && PHP_VERSION_ID >= 80000 && $reflector instanceof \ReflectionProperty && $reflector->isPromoted()) { |
|
| 369 | 369 | $constructor = $reflector->getDeclaringClass()->getConstructor(); |
| 370 | - if (!$constructor) { |
|
| 370 | + if ( ! $constructor) { |
|
| 371 | 371 | return []; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | $docComment = $constructor->getDocComment(); |
| 375 | 375 | |
| 376 | - if (!$docComment) { |
|
| 376 | + if ( ! $docComment) { |
|
| 377 | 377 | return []; |
| 378 | 378 | } |
| 379 | 379 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | return $this->flattenParamTagValueTypes($reflector->getName(), $phpDocNode->getParamTagValues()); |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | - if (!$docComment) { |
|
| 386 | + if ( ! $docComment) { |
|
| 387 | 387 | return []; |
| 388 | 388 | } |
| 389 | 389 | |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | return sprintf('array<%s>', implode( |
| 429 | 429 | ',', |
| 430 | - array_map(static function (string $type) use ($reflector, $self) { |
|
| 430 | + array_map(static function(string $type) use ($reflector, $self) { |
|
| 431 | 431 | return $self->resolveType(trim($type), $reflector); |
| 432 | 432 | }, $types) |
| 433 | 433 | )); |