@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | if (Type::isCompositeType($initialType)) { |
95 | 95 | $this->parentTypeStack[] = $initialType; |
96 | 96 | } |
97 | - if (! Type::isOutputType($initialType)) { |
|
97 | + if (!Type::isOutputType($initialType)) { |
|
98 | 98 | return; |
99 | 99 | } |
100 | 100 | |
@@ -149,17 +149,17 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public static function extractTypes($type, ?array $typeMap = null) |
151 | 151 | { |
152 | - if (! $typeMap) { |
|
152 | + if (!$typeMap) { |
|
153 | 153 | $typeMap = []; |
154 | 154 | } |
155 | - if (! $type) { |
|
155 | + if (!$type) { |
|
156 | 156 | return $typeMap; |
157 | 157 | } |
158 | 158 | |
159 | 159 | if ($type instanceof WrappingType) { |
160 | 160 | return self::extractTypes($type->getWrappedType(true), $typeMap); |
161 | 161 | } |
162 | - if (! $type instanceof Type) { |
|
162 | + if (!$type instanceof Type) { |
|
163 | 163 | // Preserve these invalid types in map (at numeric index) to make them |
164 | 164 | // detectable during $schema->validate() |
165 | 165 | $i = 0; |
@@ -168,14 +168,14 @@ discard block |
||
168 | 168 | $alreadyInMap = $alreadyInMap || $typeMap[$i] === $type; |
169 | 169 | $i++; |
170 | 170 | } |
171 | - if (! $alreadyInMap) { |
|
171 | + if (!$alreadyInMap) { |
|
172 | 172 | $typeMap[$i] = $type; |
173 | 173 | } |
174 | 174 | |
175 | 175 | return $typeMap; |
176 | 176 | } |
177 | 177 | |
178 | - if (! empty($typeMap[$type->name])) { |
|
178 | + if (!empty($typeMap[$type->name])) { |
|
179 | 179 | Utils::invariant( |
180 | 180 | $typeMap[$type->name] === $type, |
181 | 181 | sprintf('Schema must contain unique named types but contains multiple types named "%s" ', $type) . |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | } |
197 | 197 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
198 | 198 | foreach ($type->getFields() as $fieldName => $field) { |
199 | - if (! empty($field->args)) { |
|
199 | + if (!empty($field->args)) { |
|
200 | 200 | $fieldArgTypes = array_map( |
201 | - static function (FieldArgument $arg) { |
|
201 | + static function(FieldArgument $arg) { |
|
202 | 202 | return $arg->getType(); |
203 | 203 | }, |
204 | 204 | $field->args |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | /** @var FieldArgument $argDef */ |
324 | 324 | $argDef = Utils::find( |
325 | 325 | $fieldOrDirective->args, |
326 | - static function ($arg) use ($node) { |
|
326 | + static function($arg) use ($node) { |
|
327 | 327 | return $arg->name === $node->name->value; |
328 | 328 | } |
329 | 329 | ); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function getVisitor(ValidationContext $context) |
29 | 29 | { |
30 | 30 | return [ |
31 | - NodeKind::ARGUMENT => static function (ArgumentNode $node, $key, $parent, $path, $ancestors) use ($context) { |
|
31 | + NodeKind::ARGUMENT => static function(ArgumentNode $node, $key, $parent, $path, $ancestors) use ($context) { |
|
32 | 32 | $argDef = $context->getArgument(); |
33 | 33 | if ($argDef !== null) { |
34 | 34 | return null; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | Utils::suggestionList( |
49 | 49 | $node->name->value, |
50 | 50 | array_map( |
51 | - static function ($arg) { |
|
51 | + static function($arg) { |
|
52 | 52 | return $arg->name; |
53 | 53 | }, |
54 | 54 | $fieldDef->args |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | Utils::suggestionList( |
69 | 69 | $node->name->value, |
70 | 70 | array_map( |
71 | - static function ($arg) { |
|
71 | + static function($arg) { |
|
72 | 72 | return $arg->name; |
73 | 73 | }, |
74 | 74 | $directive->args |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | public static function unknownArgMessage($argName, $fieldName, $typeName, array $suggestedArgs) |
90 | 90 | { |
91 | 91 | $message = sprintf('Unknown argument "%s" on field "%s" of type "%s".', $argName, $fieldName, $typeName); |
92 | - if (! empty($suggestedArgs)) { |
|
92 | + if (!empty($suggestedArgs)) { |
|
93 | 93 | $message .= sprintf(' Did you mean %s?', Utils::quotedOrList($suggestedArgs)); |
94 | 94 | } |
95 | 95 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | public static function unknownDirectiveArgMessage($argName, $directiveName, array $suggestedArgs) |
103 | 103 | { |
104 | 104 | $message = sprintf('Unknown argument "%s" on directive "@%s".', $argName, $directiveName); |
105 | - if (! empty($suggestedArgs)) { |
|
105 | + if (!empty($suggestedArgs)) { |
|
106 | 106 | $message .= sprintf(' Did you mean %s?', Utils::quotedOrList($suggestedArgs)); |
107 | 107 | } |
108 | 108 |
@@ -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,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 | ], |