Skip to content

Commit ca4181c

Browse files
committed
fixing the fix
1 parent 4208ff0 commit ca4181c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

DependencyInjection/GraphqliteCompilerPass.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,21 +189,23 @@ public function process(ContainerBuilder $container): void
189189
if ($container->getParameter('graphqlite.security.introspection') === false) {
190190
$rulesDefinition[] = $container->findDefinition(DisableIntrospection::class);
191191
}
192-
if ($container->hasParameter('graphqlite.security.maximum_query_complexity')) {
193-
$complexity = $container->getParameter('graphqlite.security.maximum_query_complexity');
192+
193+
$complexity = $container->getParameter('graphqlite.security.maximum_query_complexity');
194+
if ($complexity) {
194195
Assert::integerish($complexity);
195196

196197
$rulesDefinition[] = $container->findDefinition(QueryComplexity::class)
197198
->setArgument(0, (int) $complexity);
198199
}
199200

200-
if ($container->hasParameter('graphqlite.security.maximum_query_depth')) {
201-
$depth = $container->getParameter('graphqlite.security.maximum_query_depth');
201+
$depth = $container->getParameter('graphqlite.security.maximum_query_depth');
202+
if ($depth) {
202203
Assert::integerish($depth);
203204

204205
$rulesDefinition[] = $container->findDefinition(QueryDepth::class)
205206
->setArgument(0, (int) $depth);
206207
}
208+
207209
$serverConfigDefinition->addMethodCall('setValidationRules', [$rulesDefinition]);
208210

209211
if ($disableMe === false) {

0 commit comments

Comments
 (0)