diff --git a/DependencyInjection/Compiler/ResolverTaggedServiceMappingPass.php b/DependencyInjection/Compiler/ResolverTaggedServiceMappingPass.php index d48f5ce6e..0f38342db 100644 --- a/DependencyInjection/Compiler/ResolverTaggedServiceMappingPass.php +++ b/DependencyInjection/Compiler/ResolverTaggedServiceMappingPass.php @@ -27,7 +27,7 @@ protected function checkRequirements($id, array $tag) { parent::checkRequirements($id, $tag); - if (!isset($tag['method']) || !is_string($tag['method'])) { + if (isset($tag['method']) && !is_string($tag['method'])) { throw new \InvalidArgumentException( sprintf('Service tagged "%s" must have valid "method" argument.', $id) ); diff --git a/Resolver/AbstractProxyResolver.php b/Resolver/AbstractProxyResolver.php index 7d4e30279..ec61525b8 100644 --- a/Resolver/AbstractProxyResolver.php +++ b/Resolver/AbstractProxyResolver.php @@ -42,7 +42,7 @@ public function resolve($input) } $options = $this->getSolutionOptions($alias); - $func = [$solution, $options['method']]; + $func = isset($options['method']) ? [$solution, $options['method']] : $solution; return call_user_func_array($func, $funcArgs); } diff --git a/Tests/Functional/app/Exception/ExampleException.php b/Tests/Functional/app/Exception/ExampleException.php index 8a3389d58..88eabc609 100644 --- a/Tests/Functional/app/Exception/ExampleException.php +++ b/Tests/Functional/app/Exception/ExampleException.php @@ -13,7 +13,7 @@ class ExampleException { - public function throwException() + public function __invoke() { throw new \InvalidArgumentException('Invalid argument exception'); } diff --git a/Tests/Functional/app/config/exception/services.yml b/Tests/Functional/app/config/exception/services.yml index 13b79aa37..ea0cd02cf 100644 --- a/Tests/Functional/app/config/exception/services.yml +++ b/Tests/Functional/app/config/exception/services.yml @@ -2,4 +2,4 @@ services: overblog_graphql.test.exception: class: Overblog\GraphQLBundle\Tests\Functional\app\Exception\ExampleException tags: - - { name: "overblog_graphql.resolver", alias: "example_exception", method: "throwException" } + - { name: "overblog_graphql.resolver", alias: "example_exception" }