Skip to content

Commit 629d941

Browse files
authored
Merge pull request #135 from mcg-web/optional-proxy-resolver-method-param
Adjusted tagged proxy resolver method param to be optional
2 parents 0fc439c + c1226e9 commit 629d941

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

DependencyInjection/Compiler/ResolverTaggedServiceMappingPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected function checkRequirements($id, array $tag)
2727
{
2828
parent::checkRequirements($id, $tag);
2929

30-
if (!isset($tag['method']) || !is_string($tag['method'])) {
30+
if (isset($tag['method']) && !is_string($tag['method'])) {
3131
throw new \InvalidArgumentException(
3232
sprintf('Service tagged "%s" must have valid "method" argument.', $id)
3333
);

Resolver/AbstractProxyResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function resolve($input)
4242
}
4343

4444
$options = $this->getSolutionOptions($alias);
45-
$func = [$solution, $options['method']];
45+
$func = isset($options['method']) ? [$solution, $options['method']] : $solution;
4646

4747
return call_user_func_array($func, $funcArgs);
4848
}

Tests/Functional/app/Exception/ExampleException.php

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

1414
class ExampleException
1515
{
16-
public function throwException()
16+
public function __invoke()
1717
{
1818
throw new \InvalidArgumentException('Invalid argument exception');
1919
}

Tests/Functional/app/config/exception/services.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ services:
22
overblog_graphql.test.exception:
33
class: Overblog\GraphQLBundle\Tests\Functional\app\Exception\ExampleException
44
tags:
5-
- { name: "overblog_graphql.resolver", alias: "example_exception", method: "throwException" }
5+
- { name: "overblog_graphql.resolver", alias: "example_exception" }

0 commit comments

Comments
 (0)