Skip to content

Commit f40d57a

Browse files
authored
fix: compatibility with PHP 8.2 (api-platform#5024)
* fix: compatibility with PHP 8.2 * fix cs
1 parent 14c7cba commit f40d57a

File tree

13 files changed

+13
-18
lines changed

13 files changed

+13
-18
lines changed

src/GraphQl/Resolver/Stage/ReadStage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(private readonly IriConverterInterface $iriConverter
4343
/**
4444
* {@inheritdoc}
4545
*/
46-
public function __invoke(?string $resourceClass, ?string $rootClass, Operation $operation, array $context): iterable|object|null
46+
public function __invoke(?string $resourceClass, ?string $rootClass, Operation $operation, array $context): object|array|null
4747
{
4848
if (!($operation->canRead() ?? true)) {
4949
return $context['is_collection'] ? [] : null;

src/GraphQl/Resolver/Stage/ReadStageInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
*/
2323
interface ReadStageInterface
2424
{
25-
public function __invoke(?string $resourceClass, ?string $rootClass, Operation $operation, array $context): iterable|object|null;
25+
public function __invoke(?string $resourceClass, ?string $rootClass, Operation $operation, array $context): object|array|null;
2626
}

src/GraphQl/Resolver/Stage/SerializeStage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(private readonly NormalizerInterface $normalizer, pr
3838
{
3939
}
4040

41-
public function __invoke(iterable|object|null $itemOrCollection, string $resourceClass, Operation $operation, array $context): ?array
41+
public function __invoke(object|array|null $itemOrCollection, string $resourceClass, Operation $operation, array $context): ?array
4242
{
4343
$isCollection = $operation instanceof CollectionOperationInterface;
4444
$isMutation = $operation instanceof Mutation;

src/GraphQl/Resolver/Stage/SerializeStageInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
*/
2323
interface SerializeStageInterface
2424
{
25-
public function __invoke(iterable|object|null $itemOrCollection, string $resourceClass, Operation $operation, array $context): ?array;
25+
public function __invoke(object|array|null $itemOrCollection, string $resourceClass, Operation $operation, array $context): ?array;
2626
}

src/State/CallableProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __construct(private readonly ContainerInterface $locator)
2626
/**
2727
* {@inheritDoc}
2828
*/
29-
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|iterable|null
29+
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
3030
{
3131
if (\is_callable($provider = $operation->getProvider())) {
3232
return $provider($operation, $uriVariables, $context);

src/State/ProviderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ interface ProviderInterface
2727
/**
2828
* Provides data.
2929
*/
30-
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|iterable|null;
30+
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null;
3131
}

src/Symfony/Maker/Resources/skeleton/StateProvider.tpl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class <?php echo $class_name; ?> implements ProviderInterface
1010
{
11-
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|iterable|null
11+
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
1212
{
1313
// Retrieve the state from somewhere
1414
}

tests/Fixtures/Symfony/Maker/CustomStateProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class CustomStateProvider implements ProviderInterface
99
{
10-
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|iterable|null
10+
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
1111
{
1212
// Retrieve the state from somewhere
1313
}

tests/Fixtures/TestBundle/State/CustomOutputDtoProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(private readonly ProviderInterface $itemProvider, pr
2727
/**
2828
* {@inheritDoc}
2929
*/
30-
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|iterable|null
30+
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
3131
{
3232
if ($operation instanceof CollectionOperationInterface) {
3333
$object = $this->collectionProvider->provide($operation, $uriVariables, $context);

tests/Fixtures/TestBundle/State/DummyExceptionToStatusProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
class DummyExceptionToStatusProvider implements ProviderInterface
2121
{
22-
public function provide(Operation $operation, array $uriVariables = [], array $context = []): iterable|object|null
22+
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
2323
{
2424
throw new NotFoundException();
2525
}

0 commit comments

Comments
 (0)