@@ -26,18 +26,18 @@ discard block |
||
26 | 26 | $this->fragmentDefs = []; |
27 | 27 | |
28 | 28 | return [ |
29 | - NodeKind::OPERATION_DEFINITION => function ($node) { |
|
29 | + NodeKind::OPERATION_DEFINITION => function($node) { |
|
30 | 30 | $this->operationDefs[] = $node; |
31 | 31 | |
32 | 32 | return Visitor::skipNode(); |
33 | 33 | }, |
34 | - NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $def) { |
|
34 | + NodeKind::FRAGMENT_DEFINITION => function(FragmentDefinitionNode $def) { |
|
35 | 35 | $this->fragmentDefs[] = $def; |
36 | 36 | |
37 | 37 | return Visitor::skipNode(); |
38 | 38 | }, |
39 | 39 | NodeKind::DOCUMENT => [ |
40 | - 'leave' => function () use ($context) { |
|
40 | + 'leave' => function() use ($context) { |
|
41 | 41 | $fragmentNameUsed = []; |
42 | 42 | |
43 | 43 | foreach ($this->operationDefs as $operation) { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | foreach ($this->fragmentDefs as $fragmentDef) { |
50 | 50 | $fragName = $fragmentDef->name->value; |
51 | - if (! empty($fragmentNameUsed[$fragName])) { |
|
51 | + if (!empty($fragmentNameUsed[$fragName])) { |
|
52 | 52 | continue; |
53 | 53 | } |
54 | 54 |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | public function getVisitor(ValidationContext $context) |
46 | 46 | { |
47 | 47 | return [ |
48 | - NodeKind::NULL => function (NullValueNode $node) use ($context) { |
|
48 | + NodeKind::NULL => function(NullValueNode $node) use ($context) { |
|
49 | 49 | $type = $context->getInputType(); |
50 | - if (! ($type instanceof NonNull)) { |
|
50 | + if (!($type instanceof NonNull)) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
@@ -58,21 +58,21 @@ discard block |
||
58 | 58 | ) |
59 | 59 | ); |
60 | 60 | }, |
61 | - NodeKind::LST => function (ListValueNode $node) use ($context) { |
|
61 | + NodeKind::LST => function(ListValueNode $node) use ($context) { |
|
62 | 62 | // Note: TypeInfo will traverse into a list's item type, so look to the |
63 | 63 | // parent input type to check if it is a list. |
64 | 64 | $type = Type::getNullableType($context->getParentInputType()); |
65 | - if (! $type instanceof ListOfType) { |
|
65 | + if (!$type instanceof ListOfType) { |
|
66 | 66 | $this->isValidScalar($context, $node); |
67 | 67 | |
68 | 68 | return Visitor::skipNode(); |
69 | 69 | } |
70 | 70 | }, |
71 | - NodeKind::OBJECT => function (ObjectValueNode $node) use ($context) { |
|
71 | + NodeKind::OBJECT => function(ObjectValueNode $node) use ($context) { |
|
72 | 72 | // Note: TypeInfo will traverse into a list's item type, so look to the |
73 | 73 | // parent input type to check if it is a list. |
74 | 74 | $type = Type::getNamedType($context->getInputType()); |
75 | - if (! $type instanceof InputObjectType) { |
|
75 | + if (!$type instanceof InputObjectType) { |
|
76 | 76 | $this->isValidScalar($context, $node); |
77 | 77 | |
78 | 78 | return Visitor::skipNode(); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $nodeFields = iterator_to_array($node->fields); |
83 | 83 | $fieldNodeMap = array_combine( |
84 | 84 | array_map( |
85 | - function ($field) { |
|
85 | + function($field) { |
|
86 | 86 | return $field->name->value; |
87 | 87 | }, |
88 | 88 | $nodeFields |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | ); |
92 | 92 | foreach ($inputFields as $fieldName => $fieldDef) { |
93 | 93 | $fieldType = $fieldDef->getType(); |
94 | - if (isset($fieldNodeMap[$fieldName]) || ! ($fieldType instanceof NonNull)) { |
|
94 | + if (isset($fieldNodeMap[$fieldName]) || !($fieldType instanceof NonNull)) { |
|
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | ); |
104 | 104 | } |
105 | 105 | }, |
106 | - NodeKind::OBJECT_FIELD => function (ObjectFieldNode $node) use ($context) { |
|
106 | + NodeKind::OBJECT_FIELD => function(ObjectFieldNode $node) use ($context) { |
|
107 | 107 | $parentType = Type::getNamedType($context->getParentInputType()); |
108 | 108 | $fieldType = $context->getInputType(); |
109 | - if ($fieldType || ! ($parentType instanceof InputObjectType)) { |
|
109 | + if ($fieldType || !($parentType instanceof InputObjectType)) { |
|
110 | 110 | return; |
111 | 111 | } |
112 | 112 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $node->name->value, |
115 | 115 | array_keys($parentType->getFields()) |
116 | 116 | ); |
117 | - $didYouMean = $suggestions |
|
117 | + $didYouMean = $suggestions |
|
118 | 118 | ? 'Did you mean ' . Utils::orList($suggestions) . '?' |
119 | 119 | : null; |
120 | 120 | |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | ) |
126 | 126 | ); |
127 | 127 | }, |
128 | - NodeKind::ENUM => function (EnumValueNode $node) use ($context) { |
|
128 | + NodeKind::ENUM => function(EnumValueNode $node) use ($context) { |
|
129 | 129 | $type = Type::getNamedType($context->getInputType()); |
130 | - if (! $type instanceof EnumType) { |
|
130 | + if (!$type instanceof EnumType) { |
|
131 | 131 | $this->isValidScalar($context, $node); |
132 | - } elseif (! $type->getValue($node->value)) { |
|
132 | + } elseif (!$type->getValue($node->value)) { |
|
133 | 133 | $context->reportError( |
134 | 134 | new Error( |
135 | 135 | self::badValueMessage( |
@@ -142,16 +142,16 @@ discard block |
||
142 | 142 | ); |
143 | 143 | } |
144 | 144 | }, |
145 | - NodeKind::INT => function (IntValueNode $node) use ($context) { |
|
145 | + NodeKind::INT => function(IntValueNode $node) use ($context) { |
|
146 | 146 | $this->isValidScalar($context, $node); |
147 | 147 | }, |
148 | - NodeKind::FLOAT => function (FloatValueNode $node) use ($context) { |
|
148 | + NodeKind::FLOAT => function(FloatValueNode $node) use ($context) { |
|
149 | 149 | $this->isValidScalar($context, $node); |
150 | 150 | }, |
151 | - NodeKind::STRING => function (StringValueNode $node) use ($context) { |
|
151 | + NodeKind::STRING => function(StringValueNode $node) use ($context) { |
|
152 | 152 | $this->isValidScalar($context, $node); |
153 | 153 | }, |
154 | - NodeKind::BOOLEAN => function (BooleanValueNode $node) use ($context) { |
|
154 | + NodeKind::BOOLEAN => function(BooleanValueNode $node) use ($context) { |
|
155 | 155 | $this->isValidScalar($context, $node); |
156 | 156 | }, |
157 | 157 | ]; |
@@ -168,13 +168,13 @@ discard block |
||
168 | 168 | // Report any error at the full type expected by the location. |
169 | 169 | $locationType = $context->getInputType(); |
170 | 170 | |
171 | - if (! $locationType) { |
|
171 | + if (!$locationType) { |
|
172 | 172 | return; |
173 | 173 | } |
174 | 174 | |
175 | 175 | $type = Type::getNamedType($locationType); |
176 | 176 | |
177 | - if (! $type instanceof ScalarType) { |
|
177 | + if (!$type instanceof ScalarType) { |
|
178 | 178 | $context->reportError( |
179 | 179 | new Error( |
180 | 180 | self::badValueMessage( |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $suggestions = Utils::suggestionList( |
235 | 235 | Printer::doPrint($node), |
236 | 236 | array_map( |
237 | - function (EnumValueDefinition $value) { |
|
237 | + function(EnumValueDefinition $value) { |
|
238 | 238 | return $value->name; |
239 | 239 | }, |
240 | 240 | $type->getValues() |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | { |
20 | 20 | return [ |
21 | 21 | NodeKind::FIELD => [ |
22 | - 'leave' => function (FieldNode $fieldNode) use ($context) { |
|
22 | + 'leave' => 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)) { |
|
36 | + if ($argNode || !($argDef->getType() instanceof NonNull)) { |
|
37 | 37 | continue; |
38 | 38 | } |
39 | 39 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | }, |
46 | 46 | ], |
47 | 47 | NodeKind::DIRECTIVE => [ |
48 | - 'leave' => function (DirectiveNode $directiveNode) use ($context) { |
|
48 | + 'leave' => 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)) { |
|
61 | + if ($argNode || !($argDef->getType() instanceof NonNull)) { |
|
62 | 62 | continue; |
63 | 63 | } |
64 | 64 |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public static function allRules() |
116 | 116 | { |
117 | - if (! self::$initRules) { |
|
117 | + if (!self::$initRules) { |
|
118 | 118 | static::$rules = array_merge(static::defaultRules(), self::securityRules(), self::$rules); |
119 | 119 | static::$initRules = true; |
120 | 120 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | return is_array($value) |
236 | 236 | ? count(array_filter( |
237 | 237 | $value, |
238 | - function ($item) { |
|
238 | + function($item) { |
|
239 | 239 | return $item instanceof \Exception || $item instanceof \Throwable; |
240 | 240 | } |
241 | 241 | )) === count($value) |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | { |
134 | 134 | $result = []; |
135 | 135 | |
136 | - if (! empty($this->errors)) { |
|
137 | - $errorsHandler = $this->errorsHandler ?: function (array $errors, callable $formatter) { |
|
136 | + if (!empty($this->errors)) { |
|
137 | + $errorsHandler = $this->errorsHandler ?: function(array $errors, callable $formatter) { |
|
138 | 138 | return array_map($formatter, $errors); |
139 | 139 | }; |
140 | 140 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $result['data'] = $this->data; |
149 | 149 | } |
150 | 150 | |
151 | - if (! empty($this->extensions)) { |
|
151 | + if (!empty($this->extensions)) { |
|
152 | 152 | $result['extensions'] = (array) $this->extensions; |
153 | 153 | } |
154 | 154 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | /** @var InputType|Type $varType */ |
53 | 53 | $varType = TypeInfo::typeFromAST($schema, $varDefNode->type); |
54 | 54 | |
55 | - if (! Type::isInputType($varType)) { |
|
55 | + if (!Type::isInputType($varType)) { |
|
56 | 56 | $errors[] = new Error( |
57 | 57 | sprintf( |
58 | 58 | 'Variable "$%s" expected value of type "%s" which cannot be used as an input type.', |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | [$varDefNode->type] |
63 | 63 | ); |
64 | 64 | } else { |
65 | - if (! array_key_exists($varName, $inputs)) { |
|
65 | + if (!array_key_exists($varName, $inputs)) { |
|
66 | 66 | if ($varType instanceof NonNull) { |
67 | 67 | $errors[] = new Error( |
68 | 68 | sprintf( |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $coerced = Value::coerceValue($value, $varType, $varDefNode); |
81 | 81 | /** @var Error[] $coercionErrors */ |
82 | 82 | $coercionErrors = $coerced['errors']; |
83 | - if (! empty($coercionErrors)) { |
|
83 | + if (!empty($coercionErrors)) { |
|
84 | 84 | $messagePrelude = sprintf( |
85 | 85 | 'Variable "$%s" got invalid value %s; ', |
86 | 86 | $varName, |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | if (isset($node->directives) && $node->directives instanceof NodeList) { |
126 | 126 | $directiveNode = Utils::find( |
127 | 127 | $node->directives, |
128 | - function (DirectiveNode $directive) use ($directiveDef) { |
|
128 | + function(DirectiveNode $directive) use ($directiveDef) { |
|
129 | 129 | return $directive->name->value === $directiveDef->name; |
130 | 130 | } |
131 | 131 | ); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | /** @var ArgumentNode[] $argNodeMap */ |
163 | 163 | $argNodeMap = $argNodes ? Utils::keyMap( |
164 | 164 | $argNodes, |
165 | - function (ArgumentNode $arg) { |
|
165 | + function(ArgumentNode $arg) { |
|
166 | 166 | return $arg->name->value; |
167 | 167 | } |
168 | 168 | ) : []; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $argType = $argDef->getType(); |
173 | 173 | $argumentNode = $argNodeMap[$name] ?? null; |
174 | 174 | |
175 | - if (! $argumentNode) { |
|
175 | + if (!$argumentNode) { |
|
176 | 176 | if ($argDef->defaultValueExists()) { |
177 | 177 | $coercedValues[$name] = $argDef->defaultValue; |
178 | 178 | } elseif ($argType instanceof NonNull) { |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | return $errors |
244 | 244 | ? array_map( |
245 | - function (Throwable $error) { |
|
245 | + function(Throwable $error) { |
|
246 | 246 | return $error->getMessage(); |
247 | 247 | }, |
248 | 248 | $errors |
@@ -80,12 +80,12 @@ |
||
80 | 80 | // TODO: rework with generators when PHP minimum required version is changed to 5.5+ |
81 | 81 | $promisesOrValues = Utils::map( |
82 | 82 | $promisesOrValues, |
83 | - function ($item) { |
|
83 | + function($item) { |
|
84 | 84 | return $item instanceof Promise ? $item->adoptedPromise : $item; |
85 | 85 | } |
86 | 86 | ); |
87 | 87 | |
88 | - $promise = all($promisesOrValues)->then(function ($values) use ($promisesOrValues) { |
|
88 | + $promise = all($promisesOrValues)->then(function($values) use ($promisesOrValues) { |
|
89 | 89 | $orderedResults = []; |
90 | 90 | |
91 | 91 | foreach ($promisesOrValues as $key => $value) { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public static function runQueue() |
41 | 41 | { |
42 | 42 | $q = self::$queue; |
43 | - while ($q && ! $q->isEmpty()) { |
|
43 | + while ($q && !$q->isEmpty()) { |
|
44 | 44 | $task = $q->dequeue(); |
45 | 45 | $task(); |
46 | 46 | } |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | } |
56 | 56 | if (is_object($value) && method_exists($value, 'then')) { |
57 | 57 | $value->then( |
58 | - function ($resolvedValue) { |
|
58 | + function($resolvedValue) { |
|
59 | 59 | $this->resolve($resolvedValue); |
60 | 60 | }, |
61 | - function ($reason) { |
|
61 | + function($reason) { |
|
62 | 62 | $this->reject($reason); |
63 | 63 | } |
64 | 64 | ); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | public function reject($reason) |
86 | 86 | { |
87 | - if (! $reason instanceof \Exception && ! $reason instanceof \Throwable) { |
|
87 | + if (!$reason instanceof \Exception && !$reason instanceof \Throwable) { |
|
88 | 88 | throw new \Exception('SyncPromise::reject() has to be called with an instance of \Throwable'); |
89 | 89 | } |
90 | 90 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | ); |
115 | 115 | |
116 | 116 | foreach ($this->waiting as $descriptor) { |
117 | - self::getQueue()->enqueue(function () use ($descriptor) { |
|
117 | + self::getQueue()->enqueue(function() use ($descriptor) { |
|
118 | 118 | /** @var $promise self */ |
119 | 119 | list($promise, $onFulfilled, $onRejected) = $descriptor; |
120 | 120 | |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | |
152 | 152 | public function then(?callable $onFulfilled = null, ?callable $onRejected = null) |
153 | 153 | { |
154 | - if ($this->state === self::REJECTED && ! $onRejected) { |
|
154 | + if ($this->state === self::REJECTED && !$onRejected) { |
|
155 | 155 | return $this; |
156 | 156 | } |
157 | - if ($this->state === self::FULFILLED && ! $onFulfilled) { |
|
157 | + if ($this->state === self::FULFILLED && !$onFulfilled) { |
|
158 | 158 | return $this; |
159 | 159 | } |
160 | 160 | $tmp = new self(); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function convertThenable($thenable) |
33 | 33 | { |
34 | - if (! $thenable instanceof Deferred) { |
|
34 | + if (!$thenable instanceof Deferred) { |
|
35 | 35 | throw new InvariantViolation('Expected instance of GraphQL\Deferred, got ' . Utils::printSafe($thenable)); |
36 | 36 | } |
37 | 37 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | if ($promiseOrValue instanceof Promise) { |
112 | 112 | $result[$index] = null; |
113 | 113 | $promiseOrValue->then( |
114 | - function ($value) use ($index, &$count, $total, &$result, $all) { |
|
114 | + function($value) use ($index, &$count, $total, &$result, $all) { |
|
115 | 115 | $result[$index] = $value; |
116 | 116 | $count++; |
117 | 117 | if ($count < $total) { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $promiseQueue = SyncPromise::getQueue(); |
147 | 147 | |
148 | 148 | while ($promise->adoptedPromise->state === SyncPromise::PENDING && |
149 | - ! ($dfdQueue->isEmpty() && $promiseQueue->isEmpty()) |
|
149 | + !($dfdQueue->isEmpty() && $promiseQueue->isEmpty()) |
|
150 | 150 | ) { |
151 | 151 | Deferred::runQueue(); |
152 | 152 | SyncPromise::runQueue(); |