Skip to content

Commit 13ac7ad

Browse files
committed
fix phpstan due to typeDeclarations: true
1 parent 1fb80b1 commit 13ac7ad

16 files changed

+22
-44
lines changed

src/GraphQl/Tests/Type/TypeBuilderTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class TypeBuilderTest extends TestCase
5454
use ProphecyTrait;
5555

5656
private ObjectProphecy $typesContainerProphecy;
57-
/** @var callable */
5857
private \Closure $defaultFieldResolver;
5958
private ObjectProphecy $fieldsBuilderLocatorProphecy;
6059
private TypeBuilder $typeBuilder;

src/Metadata/ApiResource.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,9 +1099,6 @@ public function withTypes(array|string $types): static
10991099
return $self;
11001100
}
11011101

1102-
/**
1103-
* @return array|mixed|string|null
1104-
*/
11051102
public function getFormats(): string|array|null
11061103
{
11071104
return $this->formats;
@@ -1115,17 +1112,11 @@ public function withFormats(mixed $formats): static
11151112
return $self;
11161113
}
11171114

1118-
/**
1119-
* @return array|mixed|string|null
1120-
*/
11211115
public function getInputFormats(): string|array|null
11221116
{
11231117
return $this->inputFormats;
11241118
}
11251119

1126-
/**
1127-
* @param mixed|null $inputFormats
1128-
*/
11291120
public function withInputFormats(string|array|null $inputFormats): static
11301121
{
11311122
$self = clone $this;
@@ -1134,17 +1125,11 @@ public function withInputFormats(string|array|null $inputFormats): static
11341125
return $self;
11351126
}
11361127

1137-
/**
1138-
* @return array|mixed|string|null
1139-
*/
11401128
public function getOutputFormats(): string|array|null
11411129
{
11421130
return $this->outputFormats;
11431131
}
11441132

1145-
/**
1146-
* @param mixed|null $outputFormats
1147-
*/
11481133
public function withOutputFormats(string|array|null $outputFormats): static
11491134
{
11501135
$self = clone $this;

src/Metadata/GraphQl/Operation.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,13 @@
2121
class Operation extends AbstractOperation
2222
{
2323
/**
24-
* @param Link[]|null $links
25-
* @param array{
26-
* class?: string|null,
27-
* name?: string,
28-
* }|string|false|null $input {@see https://api-platform.com/docs/core/dto/#specifying-an-input-or-an-output-data-representation}
29-
* @param array{
30-
* class?: string|null,
31-
* name?: string,
32-
* }|string|false|null $output {@see https://api-platform.com/docs/core/dto/#specifying-an-input-or-an-output-data-representation}
24+
* @param Link[]|null $links
25+
* @param string|null $input {@see https://api-platform.com/docs/core/dto/#specifying-an-input-or-an-output-data-representation}
26+
* @param string|null $output {@see https://api-platform.com/docs/core/dto/#specifying-an-input-or-an-output-data-representation}
3327
* @param string|array|bool|null $mercure {@see https://api-platform.com/docs/core/mercure}
3428
* @param string|bool|null $messenger {@see https://api-platform.com/docs/core/messenger/#dispatching-a-resource-through-the-message-bus}
35-
* @param string|callable|null $provider {@see https://api-platform.com/docs/core/state-providers/#state-providers}
36-
* @param string|callable|null $processor {@see https://api-platform.com/docs/core/state-processors/#state-processors}
29+
* @param string|null $provider {@see https://api-platform.com/docs/core/state-providers/#state-providers}
30+
* @param string|null $processor {@see https://api-platform.com/docs/core/state-processors/#state-processors}
3731
*/
3832
public function __construct(
3933
protected ?string $resolver = null,

src/Metadata/GraphQl/Query.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public function __construct(
5353
?string $deprecationReason = null,
5454
?array $filters = null,
5555
?array $validationContext = null,
56-
?array $input = null,
57-
?array $output = null,
56+
?string $input = null,
57+
?string $output = null,
5858
$mercure = null,
5959
$messenger = null,
6060
?int $urlGenerationStrategy = null,

src/Metadata/GraphQl/QueryCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public function __construct(
5454
?string $deprecationReason = null,
5555
?array $filters = null,
5656
?array $validationContext = null,
57-
?array $input = null,
58-
?array $output = null,
57+
?string $input = null,
58+
?string $output = null,
5959
$mercure = null,
6060
$messenger = null,
6161
?int $urlGenerationStrategy = null,

src/Metadata/GraphQl/Subscription.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public function __construct(
5353
?string $deprecationReason = null,
5454
?array $filters = null,
5555
?array $validationContext = null,
56-
?array $input = null,
57-
?array $output = null,
56+
?string $input = null,
57+
?string $output = null,
5858
$mercure = null,
5959
$messenger = null,
6060
?int $urlGenerationStrategy = null,

src/Symfony/Validator/Metadata/Property/Restriction/PropertySchemaChoiceRestriction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function supports(Constraint $constraint, ApiProperty $propertyMetadata):
106106
return false;
107107
}
108108

109-
$types = array_map(static fn (LegacyType $type) => $type->getBuiltinType(), $propertyMetadata->getBuiltinTypes() ?? []);
109+
$types = array_map(static fn (LegacyType $type): string => $type->getBuiltinType(), $propertyMetadata->getBuiltinTypes() ?? []);
110110
if ($propertyMetadata->getExtraProperties()['nested_schema'] ?? false) {
111111
$types = [LegacyType::BUILTIN_TYPE_STRING];
112112
}
@@ -116,7 +116,7 @@ public function supports(Constraint $constraint, ApiProperty $propertyMetadata):
116116
&& $builtinType->isCollection()
117117
&& \count($builtinType->getCollectionValueTypes()) > 0
118118
) {
119-
$types = array_unique(array_merge($types, array_map(static fn (LegacyType $type) => $type->getBuiltinType(), $builtinType->getCollectionValueTypes())));
119+
$types = array_unique(array_merge($types, array_map(static fn (LegacyType $type): string => $type->getBuiltinType(), $builtinType->getCollectionValueTypes())));
120120
}
121121

122122
return \count($types) > 0 && \count(array_intersect($types, [LegacyType::BUILTIN_TYPE_STRING, LegacyType::BUILTIN_TYPE_INT, LegacyType::BUILTIN_TYPE_FLOAT])) > 0;

src/Symfony/Validator/Metadata/Property/Restriction/PropertySchemaGreaterThanOrEqualRestriction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function supports(Constraint $constraint, ApiProperty $propertyMetadata):
5252
return $type->isIdentifiedBy(TypeIdentifier::INT, TypeIdentifier::FLOAT);
5353
}
5454

55-
$types = array_map(static fn (LegacyType $type) => $type->getBuiltinType(), $propertyMetadata->getBuiltinTypes() ?? []);
55+
$types = array_map(static fn (LegacyType $type): string => $type->getBuiltinType(), $propertyMetadata->getBuiltinTypes() ?? []);
5656
if ($propertyMetadata->getExtraProperties()['nested_schema'] ?? false) {
5757
$types = [LegacyType::BUILTIN_TYPE_INT];
5858
}

src/Symfony/Validator/Metadata/Property/Restriction/PropertySchemaGreaterThanRestriction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function supports(Constraint $constraint, ApiProperty $propertyMetadata):
5656
return $type->isIdentifiedBy(TypeIdentifier::INT, TypeIdentifier::FLOAT);
5757
}
5858

59-
$types = array_map(static fn (LegacyType $type) => $type->getBuiltinType(), $propertyMetadata->getBuiltinTypes() ?? []);
59+
$types = array_map(static fn (LegacyType $type): string => $type->getBuiltinType(), $propertyMetadata->getBuiltinTypes() ?? []);
6060
if ($propertyMetadata->getExtraProperties()['nested_schema'] ?? false) {
6161
$types = [LegacyType::BUILTIN_TYPE_INT];
6262
}

src/Symfony/Validator/Metadata/Property/Restriction/PropertySchemaLengthRestriction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function supports(Constraint $constraint, ApiProperty $propertyMetadata):
5959
return $constraint instanceof Length && $type?->isIdentifiedBy(TypeIdentifier::STRING);
6060
}
6161

62-
$types = array_map(static fn (LegacyType $type) => $type->getBuiltinType(), $propertyMetadata->getBuiltinTypes() ?? []);
62+
$types = array_map(static fn (LegacyType $type): string => $type->getBuiltinType(), $propertyMetadata->getBuiltinTypes() ?? []);
6363
if ($propertyMetadata->getExtraProperties()['nested_schema'] ?? false) {
6464
$types = [LegacyType::BUILTIN_TYPE_STRING];
6565
}

0 commit comments

Comments
 (0)