diff --git a/src/Bridge/Doctrine/Orm/Query/DoctrineOrmProxyQueryFactory.php b/src/Bridge/Doctrine/Orm/Query/DoctrineOrmProxyQueryFactory.php index 1dfb94aa..19b570fc 100644 --- a/src/Bridge/Doctrine/Orm/Query/DoctrineOrmProxyQueryFactory.php +++ b/src/Bridge/Doctrine/Orm/Query/DoctrineOrmProxyQueryFactory.php @@ -13,10 +13,11 @@ class DoctrineOrmProxyQueryFactory implements ProxyQueryFactoryInterface { public function create(mixed $data): ProxyQueryInterface { - if ($data instanceof QueryBuilder) { - return new DoctrineOrmProxyQuery($data); - } + return new DoctrineOrmProxyQuery($data); + } - throw new UnexpectedTypeException($data, QueryBuilder::class); + public function supports(mixed $data): bool + { + return $data instanceof QueryBuilder; } } diff --git a/src/Query/ProxyQueryFactoryInterface.php b/src/Query/ProxyQueryFactoryInterface.php index 28527724..f2dff007 100755 --- a/src/Query/ProxyQueryFactoryInterface.php +++ b/src/Query/ProxyQueryFactoryInterface.php @@ -7,4 +7,6 @@ interface ProxyQueryFactoryInterface { public function create(mixed $data): ProxyQueryInterface; + + public function supports(mixed $data): bool; }