From 1cb4cee2500db3ee60ea8c5b32d95aa7cdf727ea Mon Sep 17 00:00:00 2001 From: Egor Korobov Date: Thu, 8 Oct 2020 15:46:42 +0500 Subject: [PATCH] Fix Symfony setDeprecated() arguments --- src/DependencyInjection/Configuration.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 0f6fc8231..109fbe461 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -14,6 +14,7 @@ use Overblog\GraphQLBundle\Executor\Executor; use Overblog\GraphQLBundle\ExpressionLanguage\ExpressionLanguage; use Overblog\GraphQLBundle\Resolver\FieldResolver; +use Symfony\Component\Config\Definition\BaseNode; use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\Definition\Builder\EnumNodeDefinition; use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition; @@ -223,7 +224,7 @@ private function definitionsSchemaSection(): ArrayNodeDefinition ->arrayNode('resolver_maps') ->defaultValue([]) ->prototype('scalar')->end() - ->setDeprecated('The "%path%.%node%" configuration is deprecated since version 0.13 and will be removed in 1.0. Add the "overblog_graphql.resolver_map" tag to the services instead.') + ->setDeprecated(...$this->getDeprecationParameters('The "%path%.%node%" configuration is deprecated since version 0.13 and will be removed in 1.0. Add the "overblog_graphql.resolver_map" tag to the services instead.', '1.0')) ->end() ->arrayNode('types') ->defaultValue([]) @@ -394,4 +395,21 @@ private function securityQuerySection(string $name, $disabledValue): ScalarNodeD return $node; } + + /** + * Returns the correct deprecation parameters for setDeprecated. + * + * @param string $message + * @param string $version + * + * @return string[] + */ + private function getDeprecationParameters($message, $version) + { + if (method_exists(BaseNode::class, 'getDeprecation')) { + return ['overblog/graphql-bundle', $version, $message]; + } + + return [$message]; + } }