@@ -215,10 +215,10 @@ |
||
215 | 215 | |
216 | 216 | if (count($values) !== count($keys)) { |
217 | 217 | $this->handleFailedDispatch($batch, new \RuntimeException( |
218 | - DataLoader::class . ' must be constructed with a function which accepts ' . |
|
219 | - 'an array of keys and returns a Promise which resolves to an array of values, but ' . |
|
220 | - 'the function did not return a Promise of an array of the same length as the array of keys.' . |
|
221 | - sprintf("\n Keys: %s\n Values: %s\n", count($keys), count($values)) |
|
218 | + DataLoader::class . ' must be constructed with a function which accepts ' . |
|
219 | + 'an array of keys and returns a Promise which resolves to an array of values, but ' . |
|
220 | + 'the function did not return a Promise of an array of the same length as the array of keys.' . |
|
221 | + sprintf("\n Keys: %s\n Values: %s\n", count($keys), count($values)) |
|
222 | 222 | )); |
223 | 223 | } |
224 | 224 |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | $promise = new Promise( |
72 | - function (callable $resolve, callable $reject) use ($key) { |
|
72 | + function(callable $resolve, callable $reject) use ($key) { |
|
73 | 73 | $this->promiseQueue[] = [ |
74 | 74 | 'key' => $key, |
75 | 75 | 'resolve' => $resolve, |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | { |
97 | 97 | return \React\Promise\all( |
98 | 98 | array_map( |
99 | - function ($key) { |
|
99 | + function($key) { |
|
100 | 100 | return $this->load($key); |
101 | 101 | }, |
102 | 102 | $keys |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function prime($key, $value) |
131 | 131 | { |
132 | - if (! $this->promiseCache->get($key)) { |
|
132 | + if ( ! $this->promiseCache->get($key)) { |
|
133 | 133 | // Cache a rejected promise if the value is an Exception, in order to match |
134 | 134 | // the behavior of load($key). |
135 | 135 | $promise = $value instanceof \Exception ? \React\Promise\reject($value) : \React\Promise\resolve($value); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | { |
151 | 151 | if ($this->options->shouldBatch()) { |
152 | 152 | $this->eventLoop->nextTick( |
153 | - function () { |
|
153 | + function() { |
|
154 | 154 | $this->dispatchQueue(); |
155 | 155 | } |
156 | 156 | ); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | /** @var Promise $batchPromise */ |
196 | 196 | $batchPromise = $batchLoadFunction($keys); |
197 | 197 | |
198 | - if (! $batchPromise || ! is_callable([$batchPromise, 'then'])) { |
|
198 | + if ( ! $batchPromise || ! is_callable([$batchPromise, 'then'])) { |
|
199 | 199 | throw new \RuntimeException( |
200 | 200 | self::class . ' must be constructed with a function which accepts ' . |
201 | 201 | 'an array of keys and returns a Promise which resolves to an array of values ' . |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | $batchPromise->then( |
207 | - function ($values) use ($batch, $keys) { |
|
208 | - if (! is_array($values)) { |
|
207 | + function($values) use ($batch, $keys) { |
|
208 | + if ( ! is_array($values)) { |
|
209 | 209 | $this->handleFailedDispatch($batch, new \RuntimeException( |
210 | 210 | DataLoader::class . ' must be constructed with a function which accepts ' . |
211 | 211 | 'an array of keys and returns a Promise which resolves to an array of values ' . |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | } |
234 | 234 | }, |
235 | - function ($error) use ($batch) { |
|
235 | + function($error) use ($batch) { |
|
236 | 236 | $this->handleFailedDispatch($batch, $error); |
237 | 237 | } |
238 | 238 | ); |
@@ -70,11 +70,11 @@ |
||
70 | 70 | */ |
71 | 71 | private function validateOptions($maxBatchSize, $shouldBatch, $shouldCache) |
72 | 72 | { |
73 | - if (! is_bool($shouldBatch)) { |
|
73 | + if ( ! is_bool($shouldBatch)) { |
|
74 | 74 | throw new \InvalidArgumentException('Expected argument $shouldBatch to be a boolean'); |
75 | 75 | } |
76 | 76 | |
77 | - if (! is_bool($shouldCache)) { |
|
77 | + if ( ! is_bool($shouldCache)) { |
|
78 | 78 | throw new \InvalidArgumentException('Expected argument $shouldCache to be a boolean'); |
79 | 79 | } |
80 | 80 |