Skip to content

Commit 5c8050e

Browse files
committed
typeDeclarations true to squash
1 parent 334a263 commit 5c8050e

15 files changed

Lines changed: 48 additions & 48 deletions

File tree

src/Hydra/Serializer/DocumentationNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ private function getClass(string $resourceClass, ApiResource $resourceMetadata,
156156
$class['subClassOf'] = 'Error';
157157
}
158158

159-
$types = array_values(array_filter($resourceMetadata->getTypes() ?? [], static fn (string $type) => $type !== $prefixedShortName));
159+
$types = array_values(array_filter($resourceMetadata->getTypes() ?? [], static fn (string $type): bool => $type !== $prefixedShortName));
160160
if ($types) {
161161
$class['subClassOf'] = 1 === \count($types) ? $types[0] : $types;
162162
}

src/Hydra/Tests/Serializer/CollectionNormalizerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function testNormalizeResourceWithKeysCollection(bool $preserveKeys): voi
160160

161161
$delegateNormalizerProphecy = $this->createMock(NormalizerInterface::class);
162162
$delegateNormalizerProphecy->method('normalize')->willReturnCallback(
163-
static fn (Foo $item) => 1 === $item->id ? $normalizedFooOne : $normalizedFooThree
163+
static fn (Foo $item): array => 1 === $item->id ? $normalizedFooOne : $normalizedFooThree
164164
);
165165

166166
$normalizer = new CollectionNormalizer($contextBuilderProphecy, $resourceClassResolverProphecy, $iriConverterProphecy);

src/JsonApi/Tests/Serializer/ItemNormalizerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ public function testDenormalizeWithEntityIdentifier(): void
781781
$getOperation = (new Get(uriVariables: ['id' => new Link(parameterName: 'id', identifiers: ['id'], fromClass: Dummy::class)]))->withClass(Dummy::class);
782782

783783
$iriConverterProphecy = $this->prophesize(IriConverterInterface::class);
784-
$iriConverterProphecy->getIriFromResource(Dummy::class, UrlGeneratorInterface::ABS_PATH, $getOperation, Argument::that(static fn ($ctx) => ($ctx['uri_variables'] ?? null) === ['id' => '10']))->willReturn('/dummies/10');
784+
$iriConverterProphecy->getIriFromResource(Dummy::class, UrlGeneratorInterface::ABS_PATH, $getOperation, Argument::that(static fn ($ctx): bool => ($ctx['uri_variables'] ?? null) === ['id' => '10']))->willReturn('/dummies/10');
785785
$iriConverterProphecy->getResourceFromIri('/dummies/10', Argument::type('array'))->willReturn($dummy);
786786

787787
$propertyAccessorProphecy = $this->prophesize(PropertyAccessorInterface::class);
@@ -860,7 +860,7 @@ public function testDenormalizeRelationWithEntityIdentifier(): void
860860
);
861861

862862
$iriConverterProphecy = $this->prophesize(IriConverterInterface::class);
863-
$iriConverterProphecy->getIriFromResource(RelatedDummy::class, UrlGeneratorInterface::ABS_PATH, $getRelatedOperation, Argument::that(static fn ($ctx) => ($ctx['uri_variables'] ?? null) === ['id' => '1']))->willReturn('/related_dummies/1');
863+
$iriConverterProphecy->getIriFromResource(RelatedDummy::class, UrlGeneratorInterface::ABS_PATH, $getRelatedOperation, Argument::that(static fn ($ctx): bool => ($ctx['uri_variables'] ?? null) === ['id' => '1']))->willReturn('/related_dummies/1');
864864
$iriConverterProphecy->getResourceFromIri('/related_dummies/1', Argument::type('array'))->willReturn($relatedDummy);
865865

866866
$propertyAccessorProphecy = $this->prophesize(PropertyAccessorInterface::class);

src/Laravel/ApiPlatformDeferredProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public function register(): void
273273
);
274274
});
275275

276-
$this->app->singleton(ErrorRenderer::class, static function (Application $app) {
276+
$this->app->singleton(ErrorRenderer::class, static function (Application $app): ErrorRenderer {
277277
/** @var ConfigRepository */
278278
$config = $app['config'];
279279

src/Laravel/ApiPlatformProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ private function registerMcp(): void
10921092
);
10931093
});
10941094

1095-
$this->app->singleton(McpLoader::class, static function (Application $app) {
1095+
$this->app->singleton(McpLoader::class, static function (Application $app): McpLoader {
10961096
return new McpLoader(
10971097
$app->make(ResourceNameCollectionFactoryInterface::class),
10981098
$app->make(ResourceMetadataCollectionFactoryInterface::class),

src/Laravel/Eloquent/Metadata/ModelMetadata.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function getAttributes(Model $model): array
8080

8181
// Only exclude BelongsTo foreign keys — those are local columns on this model's table.
8282
// HasMany/HasOne foreign keys reference the related table and should not be excluded.
83-
$belongsToRelations = array_filter($relations, static fn ($r) => is_a($r['type'], BelongsTo::class, true));
83+
$belongsToRelations = array_filter($relations, static fn (array $r): bool => is_a($r['type'], BelongsTo::class, true));
8484
$foreignKeys = array_flip(array_filter(array_column($belongsToRelations, 'foreign_key')));
8585
$attributes = [];
8686

src/Metadata/GraphQl/Operation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function __construct(
7979
?int $priority = null,
8080
?string $name = null,
8181
?string $provider = null,
82-
$processor = null,
82+
?string $processor = null,
8383
?OptionsInterface $stateOptions = null,
8484
array|Parameters|null $parameters = null,
8585
?bool $queryParameterValidationEnabled = null,

tests/Functional/DefaultParametersAppKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
2626
{
2727
parent::configureContainer($c, $loader);
2828

29-
$loader->load(static function (ContainerBuilder $container) {
29+
$loader->load(static function (ContainerBuilder $container): void {
3030
if ($container->hasDefinition('phpunit_resource_name_collection')) {
3131
$container->removeDefinition('phpunit_resource_name_collection');
3232
}

tests/Functional/NestedFilterTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testIriFilterWithDirectRelation(): void
5151
$data = $response->toArray();
5252

5353
$this->assertCount(2, $data['hydra:member'], 'Should find employees in department 1');
54-
$names = array_map(static fn ($m) => $m['name'], $data['hydra:member']);
54+
$names = array_map(static fn (array $m) => $m['name'], $data['hydra:member']);
5555
$this->assertContains('Alice', $names);
5656
$this->assertContains('Charlie', $names);
5757
}
@@ -69,7 +69,7 @@ public function testIriFilterWithNestedRelation(): void
6969
$data = $response->toArray();
7070

7171
$this->assertCount(2, $data['hydra:member'], 'Should find employees whose department belongs to company 1');
72-
$names = array_map(static fn ($m) => $m['name'], $data['hydra:member']);
72+
$names = array_map(static fn (array $m) => $m['name'], $data['hydra:member']);
7373
$this->assertContains('Alice', $names);
7474
$this->assertContains('Charlie', $names);
7575
}
@@ -87,7 +87,7 @@ public function testUuidFilterWithDirectRelation(): void
8787
$data = $response->toArray();
8888

8989
$this->assertCount(2, $data['hydra:member'], 'Should find employees in department 1 by UUID');
90-
$names = array_map(static fn ($m) => $m['name'], $data['hydra:member']);
90+
$names = array_map(static fn (array $m) => $m['name'], $data['hydra:member']);
9191
$this->assertContains('Alice', $names);
9292
$this->assertContains('Charlie', $names);
9393
}
@@ -105,7 +105,7 @@ public function testUuidFilterWithNestedRelation(): void
105105
$data = $response->toArray();
106106

107107
$this->assertCount(2, $data['hydra:member'], 'Should find employees whose department belongs to company 1 by UUID');
108-
$names = array_map(static fn ($m) => $m['name'], $data['hydra:member']);
108+
$names = array_map(static fn (array $m) => $m['name'], $data['hydra:member']);
109109
$this->assertContains('Alice', $names);
110110
$this->assertContains('Charlie', $names);
111111
}

tests/Functional/Parameters/ComparisonFilterTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testGt(): void
5353
// gt "Bravo": names > "Bravo" alphabetically → Charlie, Delta
5454
$response = self::createClient()->request('GET', '/chickens?nameComparison[gt]=Bravo');
5555
$this->assertResponseIsSuccessful();
56-
$names = array_map(static fn ($c) => $c['name'], $response->toArray()['member']);
56+
$names = array_map(static fn (array $c) => $c['name'], $response->toArray()['member']);
5757
sort($names);
5858
$this->assertSame(['Charlie', 'Delta'], $names);
5959
}
@@ -63,7 +63,7 @@ public function testGte(): void
6363
// gte "Bravo": names >= "Bravo" → Bravo, Charlie, Delta
6464
$response = self::createClient()->request('GET', '/chickens?nameComparison[gte]=Bravo');
6565
$this->assertResponseIsSuccessful();
66-
$names = array_map(static fn ($c) => $c['name'], $response->toArray()['member']);
66+
$names = array_map(static fn (array $c) => $c['name'], $response->toArray()['member']);
6767
sort($names);
6868
$this->assertSame(['Bravo', 'Charlie', 'Delta'], $names);
6969
}
@@ -73,7 +73,7 @@ public function testLt(): void
7373
// lt "Charlie": names < "Charlie" → Alpha, Bravo
7474
$response = self::createClient()->request('GET', '/chickens?nameComparison[lt]=Charlie');
7575
$this->assertResponseIsSuccessful();
76-
$names = array_map(static fn ($c) => $c['name'], $response->toArray()['member']);
76+
$names = array_map(static fn (array $c) => $c['name'], $response->toArray()['member']);
7777
sort($names);
7878
$this->assertSame(['Alpha', 'Bravo'], $names);
7979
}
@@ -83,7 +83,7 @@ public function testLte(): void
8383
// lte "Charlie": names <= "Charlie" → Alpha, Bravo, Charlie
8484
$response = self::createClient()->request('GET', '/chickens?nameComparison[lte]=Charlie');
8585
$this->assertResponseIsSuccessful();
86-
$names = array_map(static fn ($c) => $c['name'], $response->toArray()['member']);
86+
$names = array_map(static fn (array $c) => $c['name'], $response->toArray()['member']);
8787
sort($names);
8888
$this->assertSame(['Alpha', 'Bravo', 'Charlie'], $names);
8989
}
@@ -93,7 +93,7 @@ public function testCombinedGtAndLt(): void
9393
// gt "Alpha" AND lt "Delta" → Bravo, Charlie
9494
$response = self::createClient()->request('GET', '/chickens?nameComparison[gt]=Alpha&nameComparison[lt]=Delta');
9595
$this->assertResponseIsSuccessful();
96-
$names = array_map(static fn ($c) => $c['name'], $response->toArray()['member']);
96+
$names = array_map(static fn (array $c) => $c['name'], $response->toArray()['member']);
9797
sort($names);
9898
$this->assertSame(['Bravo', 'Charlie'], $names);
9999
}
@@ -103,7 +103,7 @@ public function testNe(): void
103103
// ne "Bravo": all names except "Bravo" → Alpha, Charlie, Delta
104104
$response = self::createClient()->request('GET', '/chickens?nameComparison[ne]=Bravo');
105105
$this->assertResponseIsSuccessful();
106-
$names = array_map(static fn ($c) => $c['name'], $response->toArray()['member']);
106+
$names = array_map(static fn (array $c) => $c['name'], $response->toArray()['member']);
107107
sort($names);
108108
$this->assertSame(['Alpha', 'Charlie', 'Delta'], $names);
109109
}
@@ -147,7 +147,7 @@ public function testOpenApiDocumentation(): void
147147
$this->assertContains($expectedName, $parameterNames, \sprintf('Expected parameter "%s" in OpenAPI documentation', $expectedName));
148148
}
149149

150-
$comparisonParams = array_filter($parameters, static fn ($p) => str_starts_with($p['name'], 'nameComparison['));
150+
$comparisonParams = array_filter($parameters, static fn (array $p): bool => str_starts_with($p['name'], 'nameComparison['));
151151
foreach ($comparisonParams as $param) {
152152
$this->assertSame('query', $param['in']);
153153
}

0 commit comments

Comments
 (0)