Skip to content

Commit d0be2ba

Browse files
committed
t
1 parent 985fc3b commit d0be2ba

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/GraphQl/State/Provider/ReadProvider.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@
1313

1414
namespace ApiPlatform\GraphQl\State\Provider;
1515

16-
use ApiPlatform\Metadata\Exception\ItemNotFoundException;
1716
use ApiPlatform\GraphQl\Resolver\Util\IdentifierTrait;
1817
use ApiPlatform\GraphQl\Serializer\ItemNormalizer;
1918
use ApiPlatform\GraphQl\Serializer\SerializerContextBuilderInterface;
2019
use ApiPlatform\GraphQl\Util\ArrayTrait;
2120
use ApiPlatform\Metadata\CollectionOperationInterface;
21+
use ApiPlatform\Metadata\Exception\ItemNotFoundException;
2222
use ApiPlatform\Metadata\GraphQl\Mutation;
2323
use ApiPlatform\Metadata\GraphQl\Operation as GraphQlOperation;
24-
use ApiPlatform\Metadata\GraphQl\Query;
2524
use ApiPlatform\Metadata\GraphQl\QueryCollection;
2625
use ApiPlatform\Metadata\GraphQl\Subscription;
2726
use ApiPlatform\Metadata\IriConverterInterface;
@@ -79,7 +78,11 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
7978
}
8079
}
8180

82-
if (null !== $item && !\is_object($item)) {
81+
if (null === $item) {
82+
return $item;
83+
}
84+
85+
if (!\is_object($item)) {
8386
throw new \LogicException('Item from read provider should be a nullable object.');
8487
}
8588

src/GraphQl/Tests/State/Provider/ReadProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
namespace ApiPlatform\GraphQl\Tests\State\Provider;
1515

16-
use ApiPlatform\Metadata\Exception\ItemNotFoundException;
1716
use ApiPlatform\GraphQl\Serializer\SerializerContextBuilderInterface;
1817
use ApiPlatform\GraphQl\State\Provider\ReadProvider;
18+
use ApiPlatform\Metadata\Exception\ItemNotFoundException;
1919
use ApiPlatform\Metadata\GraphQl\Query;
2020
use ApiPlatform\Metadata\GraphQl\QueryCollection;
2121
use ApiPlatform\Metadata\IriConverterInterface;

0 commit comments

Comments
 (0)