We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -149,6 +149,9 @@ |
||
| 149 | 149 | return $treatedOptions; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | + /** |
|
| 153 | + * @param callable $expression |
|
| 154 | + */ |
|
| 152 | 155 | private function resolveAccessAndWrapResolveCallback($expression, callable $resolveCallback = null) |
| 153 | 156 | { |
| 154 | 157 | return function () use ($expression, $resolveCallback) { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $value = $treatedOptions['complexity']; |
| 70 | 70 | |
| 71 | - $treatedOptions['complexity'] = function () use ($value) { |
|
| 71 | + $treatedOptions['complexity'] = function() use ($value) { |
|
| 72 | 72 | $args = func_get_args(); |
| 73 | 73 | $complexity = $this->solveUsingExpressionLanguageIfNeeded( |
| 74 | 74 | $value, |
@@ -179,10 +179,10 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | private function resolveAccessAndWrapResolveCallback($expression, callable $resolveCallback = null) |
| 181 | 181 | { |
| 182 | - return function () use ($expression, $resolveCallback) { |
|
| 182 | + return function() use ($expression, $resolveCallback) { |
|
| 183 | 183 | $args = func_get_args(); |
| 184 | 184 | |
| 185 | - $result = null !== $resolveCallback ? call_user_func_array($resolveCallback, $args) : null; |
|
| 185 | + $result = null !== $resolveCallback ? call_user_func_array($resolveCallback, $args) : null; |
|
| 186 | 186 | |
| 187 | 187 | $values = call_user_func_array([$this, 'solveResolveCallbackArgs'], $args); |
| 188 | 188 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | case is_array($result) || $result instanceof \ArrayAccess: |
| 199 | 199 | $result = array_filter( |
| 200 | 200 | array_map( |
| 201 | - function ($object) use ($checkAccess) { |
|
| 201 | + function($object) use ($checkAccess) { |
|
| 202 | 202 | return $checkAccess($object) ? $object : null; |
| 203 | 203 | }, |
| 204 | 204 | $result |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | case $result instanceof Connection: |
| 210 | 210 | $result->edges = array_map( |
| 211 | - function (Edge $edge) use ($checkAccess) { |
|
| 211 | + function(Edge $edge) use ($checkAccess) { |
|
| 212 | 212 | $edge->node = $checkAccess($edge->node) ? $edge->node : null; |
| 213 | 213 | |
| 214 | 214 | return $edge; |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | private function checkAccessCallback($expression, $values) |
| 229 | 229 | { |
| 230 | - return function ($object, $throwException = false) use ($expression, $values) { |
|
| 230 | + return function($object, $throwException = false) use ($expression, $values) { |
|
| 231 | 231 | try { |
| 232 | 232 | $access = $this->solveUsingExpressionLanguageIfNeeded( |
| 233 | 233 | $expression, |
@@ -41,6 +41,7 @@ |
||
| 41 | 41 | * check if equal to 0 no check is done. Must be greater or equal to 0. |
| 42 | 42 | * |
| 43 | 43 | * @param $value |
| 44 | + * @param string $name |
|
| 44 | 45 | */ |
| 45 | 46 | protected static function checkIfGreaterOrEqualToZero($name, $value) |
| 46 | 47 | { |
@@ -111,12 +111,12 @@ |
||
| 111 | 111 | $node |
| 112 | 112 | ->info('Disabled if equal to false.') |
| 113 | 113 | ->beforeNormalization() |
| 114 | - ->ifTrue(function ($v) { return false === $v; }) |
|
| 115 | - ->then(function () use ($disabledValue) { return $disabledValue; }) |
|
| 114 | + ->ifTrue(function($v) { return false === $v; }) |
|
| 115 | + ->then(function() use ($disabledValue) { return $disabledValue; }) |
|
| 116 | 116 | ->end() |
| 117 | 117 | ->defaultFalse() |
| 118 | 118 | ->validate() |
| 119 | - ->ifTrue(function ($v) { return $v < 0; }) |
|
| 119 | + ->ifTrue(function($v) { return $v < 0; }) |
|
| 120 | 120 | ->thenInvalid('"overblog_graphql.security.'.$name.'" must be greater or equal to 0.') |
| 121 | 121 | ->end() |
| 122 | 122 | ; |
@@ -70,14 +70,14 @@ |
||
| 70 | 70 | 'fields' => [ |
| 71 | 71 | 'firstName' => ['type' => Type::nonNull(Type::string())], |
| 72 | 72 | 'dogs' => [ |
| 73 | - 'type' => function () { |
|
| 73 | + 'type' => function() { |
|
| 74 | 74 | return Type::nonNull( |
| 75 | 75 | Type::listOf( |
| 76 | 76 | Type::nonNull(self::buildDogType()) |
| 77 | 77 | ) |
| 78 | 78 | ); |
| 79 | 79 | }, |
| 80 | - 'complexity' => function ($childrenComplexity, $args) { |
|
| 80 | + 'complexity' => function($childrenComplexity, $args) { |
|
| 81 | 81 | $complexity = isset($args['name']) ? 1 : 10; |
| 82 | 82 | |
| 83 | 83 | return $childrenComplexity + $complexity; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | [ |
| 90 | 90 | // Visit FragmentDefinition after visiting FragmentSpread |
| 91 | 91 | 'visitSpreadFragments' => true, |
| 92 | - Node::SELECTION_SET => function (SelectionSet $selectionSet) use ($context) { |
|
| 92 | + Node::SELECTION_SET => function(SelectionSet $selectionSet) use ($context) { |
|
| 93 | 93 | $this->fieldAstAndDefs = $this->collectFieldASTsAndDefs( |
| 94 | 94 | $context, |
| 95 | 95 | $context->getParentType(), |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | $this->fieldAstAndDefs |
| 99 | 99 | ); |
| 100 | 100 | }, |
| 101 | - Node::VARIABLE_DEFINITION => function ($def) { |
|
| 101 | + Node::VARIABLE_DEFINITION => function($def) { |
|
| 102 | 102 | $this->variableDefs[] = $def; |
| 103 | 103 | |
| 104 | 104 | return Visitor::skipNode(); |
| 105 | 105 | }, |
| 106 | 106 | Node::OPERATION_DEFINITION => [ |
| 107 | - 'leave' => function (OperationDefinition $operationDefinition) use ($context, &$complexity) { |
|
| 107 | + 'leave' => function(OperationDefinition $operationDefinition) use ($context, &$complexity) { |
|
| 108 | 108 | $complexity = $this->fieldComplexity($operationDefinition, $complexity); |
| 109 | 109 | |
| 110 | 110 | if ($complexity > $this->getMaxQueryComplexity()) { |
@@ -117,6 +117,9 @@ |
||
| 117 | 117 | ); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | + /** |
|
| 121 | + * @param Node $node |
|
| 122 | + */ |
|
| 120 | 123 | private function fieldComplexity($node, $complexity = 0) |
| 121 | 124 | { |
| 122 | 125 | if (isset($node->selectionSet) && $node->selectionSet instanceof SelectionSet) { |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | $context, |
| 61 | 61 | [ |
| 62 | 62 | Node::OPERATION_DEFINITION => [ |
| 63 | - 'leave' => function (OperationDefinition $operationDefinition) use ($context) { |
|
| 63 | + 'leave' => function(OperationDefinition $operationDefinition) use ($context) { |
|
| 64 | 64 | $maxDepth = $this->fieldDepth($operationDefinition); |
| 65 | 65 | |
| 66 | 66 | if ($maxDepth > $this->getMaxQueryDepth()) { |
@@ -79,6 +79,9 @@ |
||
| 79 | 79 | return $this->getMaxQueryDepth() !== static::DISABLED; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | + /** |
|
| 83 | + * @param Node $node |
|
| 84 | + */ |
|
| 82 | 85 | private function fieldDepth($node, $depth = 0, $maxDepth = 0) |
| 83 | 86 | { |
| 84 | 87 | if (isset($node->selectionSet) && $node->selectionSet instanceof SelectionSet) { |