@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | public function getVisitor(ValidationContext $context) |
| 24 | 24 | { |
| 25 | 25 | return [ |
| 26 | - NodeKind::INLINE_FRAGMENT => function (InlineFragmentNode $node) use ($context) { |
|
| 26 | + NodeKind::INLINE_FRAGMENT => function(InlineFragmentNode $node) use ($context) { |
|
| 27 | 27 | $fragType = $context->getType(); |
| 28 | 28 | $parentType = $context->getParentType(); |
| 29 | 29 | |
| 30 | - if (! ($fragType instanceof CompositeType) || |
|
| 31 | - ! ($parentType instanceof CompositeType) || |
|
| 30 | + if (!($fragType instanceof CompositeType) || |
|
| 31 | + !($parentType instanceof CompositeType) || |
|
| 32 | 32 | $this->doTypesOverlap($context->getSchema(), $fragType, $parentType)) { |
| 33 | 33 | return; |
| 34 | 34 | } |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | [$node] |
| 39 | 39 | )); |
| 40 | 40 | }, |
| 41 | - NodeKind::FRAGMENT_SPREAD => function (FragmentSpreadNode $node) use ($context) { |
|
| 41 | + NodeKind::FRAGMENT_SPREAD => function(FragmentSpreadNode $node) use ($context) { |
|
| 42 | 42 | $fragName = $node->name->value; |
| 43 | 43 | $fragType = $this->getFragmentType($context, $fragName); |
| 44 | 44 | $parentType = $context->getParentType(); |
| 45 | 45 | |
| 46 | - if (! $fragType || |
|
| 47 | - ! $parentType || |
|
| 46 | + if (!$fragType || |
|
| 47 | + !$parentType || |
|
| 48 | 48 | $this->doTypesOverlap($context->getSchema(), $fragType, $parentType) |
| 49 | 49 | ) { |
| 50 | 50 | return; |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | foreach ($definedDirectives as $directive) { |
| 47 | 47 | $requiredArgsMap[$directive->name] = Utils::keyMap( |
| 48 | - array_filter($directive->args, static function (FieldArgument $arg) : bool { |
|
| 49 | - return $arg->getType() instanceof NonNull && ! isset($arg->defaultValue); |
|
| 48 | + array_filter($directive->args, static function(FieldArgument $arg) : bool { |
|
| 49 | + return $arg->getType() instanceof NonNull && !isset($arg->defaultValue); |
|
| 50 | 50 | }), |
| 51 | - static function (FieldArgument $arg) : string { |
|
| 51 | + static function(FieldArgument $arg) : string { |
|
| 52 | 52 | return $arg->name; |
| 53 | 53 | } |
| 54 | 54 | ); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $astDefinition = $context->getDocument()->definitions; |
| 58 | 58 | foreach ($astDefinition as $def) { |
| 59 | - if (! ($def instanceof DirectiveDefinitionNode)) { |
|
| 59 | + if (!($def instanceof DirectiveDefinitionNode)) { |
|
| 60 | 60 | continue; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -70,32 +70,32 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | $requiredArgsMap[$def->name->value] = Utils::keyMap( |
| 72 | 72 | $arguments |
| 73 | - ? array_filter($arguments, static function (Node $argument) : bool { |
|
| 73 | + ? array_filter($arguments, static function(Node $argument) : bool { |
|
| 74 | 74 | return $argument instanceof NonNullTypeNode && |
| 75 | 75 | ( |
| 76 | - ! isset($argument->defaultValue) || |
|
| 76 | + !isset($argument->defaultValue) || |
|
| 77 | 77 | $argument->defaultValue === null |
| 78 | 78 | ); |
| 79 | 79 | }) |
| 80 | 80 | : [], |
| 81 | - static function (NamedTypeNode $argument) : string { |
|
| 81 | + static function(NamedTypeNode $argument) : string { |
|
| 82 | 82 | return $argument->name->value; |
| 83 | 83 | } |
| 84 | 84 | ); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | return [ |
| 88 | - NodeKind::DIRECTIVE => static function (DirectiveNode $directiveNode) use ($requiredArgsMap, $context) { |
|
| 88 | + NodeKind::DIRECTIVE => static function(DirectiveNode $directiveNode) use ($requiredArgsMap, $context) { |
|
| 89 | 89 | $directiveName = $directiveNode->name->value; |
| 90 | 90 | $requiredArgs = $requiredArgsMap[$directiveName] ?? null; |
| 91 | - if (! $requiredArgs) { |
|
| 91 | + if (!$requiredArgs) { |
|
| 92 | 92 | return null; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $argNodes = $directiveNode->arguments ?: []; |
| 96 | 96 | $argNodeMap = Utils::keyMap( |
| 97 | 97 | $argNodes, |
| 98 | - static function (ArgumentNode $arg) : string { |
|
| 98 | + static function(ArgumentNode $arg) : string { |
|
| 99 | 99 | return $arg->name->value; |
| 100 | 100 | } |
| 101 | 101 | ); |
@@ -19,10 +19,10 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | return [ |
| 21 | 21 | NodeKind::FIELD => [ |
| 22 | - 'leave' => static function (FieldNode $fieldNode) use ($context) { |
|
| 22 | + 'leave' => static function(FieldNode $fieldNode) use ($context) { |
|
| 23 | 23 | $fieldDef = $context->getFieldDef(); |
| 24 | 24 | |
| 25 | - if (! $fieldDef) { |
|
| 25 | + if (!$fieldDef) { |
|
| 26 | 26 | return Visitor::skipNode(); |
| 27 | 27 | } |
| 28 | 28 | $argNodes = $fieldNode->arguments ?: []; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | foreach ($fieldDef->args as $argDef) { |
| 35 | 35 | $argNode = $argNodeMap[$argDef->name] ?? null; |
| 36 | - if ($argNode || (! ($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) { |
|
| 36 | + if ($argNode || (!($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) { |
|
| 37 | 37 | continue; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | }, |
| 46 | 46 | ], |
| 47 | 47 | NodeKind::DIRECTIVE => [ |
| 48 | - 'leave' => static function (DirectiveNode $directiveNode) use ($context) { |
|
| 48 | + 'leave' => static function(DirectiveNode $directiveNode) use ($context) { |
|
| 49 | 49 | $directiveDef = $context->getDirective(); |
| 50 | - if (! $directiveDef) { |
|
| 50 | + if (!$directiveDef) { |
|
| 51 | 51 | return Visitor::skipNode(); |
| 52 | 52 | } |
| 53 | 53 | $argNodes = $directiveNode->arguments ?: []; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | foreach ($directiveDef->args as $argDef) { |
| 60 | 60 | $argNode = $argNodeMap[$argDef->name] ?? null; |
| 61 | - if ($argNode || (! ($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) { |
|
| 61 | + if ($argNode || (!($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) { |
|
| 62 | 62 | continue; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -18,11 +18,11 @@ |
||
| 18 | 18 | public function getVisitor(ValidationContext $context) |
| 19 | 19 | { |
| 20 | 20 | return [ |
| 21 | - NodeKind::VARIABLE_DEFINITION => static function (VariableDefinitionNode $node) use ($context) { |
|
| 21 | + NodeKind::VARIABLE_DEFINITION => static function(VariableDefinitionNode $node) use ($context) { |
|
| 22 | 22 | $type = TypeInfo::typeFromAST($context->getSchema(), $node->type); |
| 23 | 23 | |
| 24 | 24 | // If the variable type is not an input type, return an error. |
| 25 | - if (! $type || Type::isInputType($type)) { |
|
| 25 | + if (!$type || Type::isInputType($type)) { |
|
| 26 | 26 | return; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | public static function allRules() |
| 126 | 126 | { |
| 127 | - if (! self::$initRules) { |
|
| 127 | + if (!self::$initRules) { |
|
| 128 | 128 | static::$rules = array_merge(static::defaultRules(), self::securityRules(), self::$rules); |
| 129 | 129 | static::$initRules = true; |
| 130 | 130 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | return is_array($value) |
| 265 | 265 | ? count(array_filter( |
| 266 | 266 | $value, |
| 267 | - static function ($item) { |
|
| 267 | + static function($item) { |
|
| 268 | 268 | return $item instanceof Throwable; |
| 269 | 269 | } |
| 270 | 270 | )) === count($value) |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | Visitor::visitWithTypeInfo( |
| 106 | 106 | $typeInfo, |
| 107 | 107 | [ |
| 108 | - NodeKind::VARIABLE_DEFINITION => static function () { |
|
| 108 | + NodeKind::VARIABLE_DEFINITION => static function() { |
|
| 109 | 109 | return false; |
| 110 | 110 | }, |
| 111 | - NodeKind::VARIABLE => static function (VariableNode $variable) use ( |
|
| 111 | + NodeKind::VARIABLE => static function(VariableNode $variable) use ( |
|
| 112 | 112 | &$newUsages, |
| 113 | 113 | $typeInfo |
| 114 | 114 | ) { |
@@ -139,19 +139,19 @@ discard block |
||
| 139 | 139 | $fragments = []; |
| 140 | 140 | $collectedNames = []; |
| 141 | 141 | $nodesToVisit = [$operation]; |
| 142 | - while (! empty($nodesToVisit)) { |
|
| 142 | + while (!empty($nodesToVisit)) { |
|
| 143 | 143 | $node = array_pop($nodesToVisit); |
| 144 | 144 | $spreads = $this->getFragmentSpreads($node); |
| 145 | 145 | foreach ($spreads as $spread) { |
| 146 | 146 | $fragName = $spread->name->value; |
| 147 | 147 | |
| 148 | - if (! empty($collectedNames[$fragName])) { |
|
| 148 | + if (!empty($collectedNames[$fragName])) { |
|
| 149 | 149 | continue; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | $collectedNames[$fragName] = true; |
| 153 | 153 | $fragment = $this->getFragment($fragName); |
| 154 | - if (! $fragment) { |
|
| 154 | + if (!$fragment) { |
|
| 155 | 155 | continue; |
| 156 | 156 | } |
| 157 | 157 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $spreads = []; |
| 178 | 178 | /** @var SelectionSetNode[] $setsToVisit */ |
| 179 | 179 | $setsToVisit = [$node->selectionSet]; |
| 180 | - while (! empty($setsToVisit)) { |
|
| 180 | + while (!empty($setsToVisit)) { |
|
| 181 | 181 | $set = array_pop($setsToVisit); |
| 182 | 182 | |
| 183 | 183 | for ($i = 0, $selectionCount = count($set->selections); $i < $selectionCount; $i++) { |
@@ -207,10 +207,10 @@ discard block |
||
| 207 | 207 | public function getFragment($name) |
| 208 | 208 | { |
| 209 | 209 | $fragments = $this->fragments; |
| 210 | - if (! $fragments) { |
|
| 210 | + if (!$fragments) { |
|
| 211 | 211 | $fragments = []; |
| 212 | 212 | foreach ($this->getDocument()->definitions as $statement) { |
| 213 | - if (! ($statement instanceof FragmentDefinitionNode)) { |
|
| 213 | + if (!($statement instanceof FragmentDefinitionNode)) { |
|
| 214 | 214 | continue; |
| 215 | 215 | } |
| 216 | 216 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | 'args' => [ |
| 20 | 20 | 'message' => ['type' => Type::string()], |
| 21 | 21 | ], |
| 22 | - 'resolve' => function ($rootValue, $args) { |
|
| 22 | + 'resolve' => function($rootValue, $args) { |
|
| 23 | 23 | return $rootValue['prefix'] . $args['message']; |
| 24 | 24 | } |
| 25 | 25 | ], |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | 'x' => ['type' => Type::int()], |
| 36 | 36 | 'y' => ['type' => Type::int()], |
| 37 | 37 | ], |
| 38 | - 'resolve' => function ($calc, $args) { |
|
| 38 | + 'resolve' => function($calc, $args) { |
|
| 39 | 39 | return $args['x'] + $args['y']; |
| 40 | 40 | }, |
| 41 | 41 | ], |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | { |
| 17 | 17 | public function resolve($rootValue, $args, $context) |
| 18 | 18 | { |
| 19 | - return $rootValue['prefix'].$args['message']; |
|
| 19 | + return $rootValue['prefix'] . $args['message']; |
|
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | { |
| 175 | 175 | $commentReplies = isset(self::$commentReplies[$commentId]) ? self::$commentReplies[$commentId] : []; |
| 176 | 176 | |
| 177 | - $start = isset($after) ? (int) array_search($afterId, $commentReplies) + 1: 0; |
|
| 177 | + $start = isset($after) ? (int) array_search($afterId, $commentReplies) + 1 : 0; |
|
| 178 | 178 | $commentReplies = array_slice($commentReplies, $start, $limit); |
| 179 | 179 | |
| 180 | 180 | return array_map( |
@@ -197,6 +197,6 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | public static function findStoryMentions($storyId) |
| 199 | 199 | { |
| 200 | - return isset(self::$storyMentions[$storyId]) ? self::$storyMentions[$storyId] :[]; |
|
| 200 | + return isset(self::$storyMentions[$storyId]) ? self::$storyMentions[$storyId] : []; |
|
| 201 | 201 | } |
| 202 | 202 | } |