Skip to content

Commit 985fc3b

Browse files
committed
reveiw
1 parent eb7cfac commit 985fc3b

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

src/GraphQl/State/Provider/ReadProvider.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace ApiPlatform\GraphQl\State\Provider;
1515

16-
use ApiPlatform\Exception\ItemNotFoundException;
16+
use ApiPlatform\Metadata\Exception\ItemNotFoundException;
1717
use ApiPlatform\GraphQl\Resolver\Util\IdentifierTrait;
1818
use ApiPlatform\GraphQl\Serializer\ItemNormalizer;
1919
use ApiPlatform\GraphQl\Serializer\SerializerContextBuilderInterface;
@@ -69,10 +69,6 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
6969
$item = null;
7070
}
7171

72-
if ($operation instanceof Query && null === $item) {
73-
return $item;
74-
}
75-
7672
if ($operation instanceof Subscription || $operation instanceof Mutation) {
7773
if (null === $item) {
7874
throw new NotFoundHttpException(sprintf('Item "%s" not found.', $args['input']['id']));
@@ -83,7 +79,7 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
8379
}
8480
}
8581

86-
if (!\is_object($item)) {
82+
if (null !== $item && !\is_object($item)) {
8783
throw new \LogicException('Item from read provider should be a nullable object.');
8884
}
8985

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

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

16-
use ApiPlatform\Exception\ItemNotFoundException;
16+
use ApiPlatform\Metadata\Exception\ItemNotFoundException;
1717
use ApiPlatform\GraphQl\Serializer\SerializerContextBuilderInterface;
1818
use ApiPlatform\GraphQl\State\Provider\ReadProvider;
1919
use ApiPlatform\Metadata\GraphQl\Query;
@@ -44,10 +44,6 @@ public function testProvide(): void
4444
*/
4545
public function testProvideNotExistedResource(): void
4646
{
47-
if (!class_exists('\ApiPlatform\Exception\ItemNotFoundException')) {
48-
class_alias('\ApiPlatform\Metadata\Exception\ItemNotFoundException', '\ApiPlatform\Exception\ItemNotFoundException');
49-
}
50-
5147
$context = ['args' => ['id' => '/dummy/1']];
5248
$operation = new Query(class: 'dummy');
5349
$decorated = $this->createMock(ProviderInterface::class);

0 commit comments

Comments
 (0)