Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Symfony setDeprecated() arguments #762

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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([])
Expand Down Expand Up @@ -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];
}
}