Skip to content

Commit e9a3918

Browse files
Merge pull request #15 from lordthorzonus/analysis-x0nJbb
Apply fixes from StyleCI
2 parents d040d01 + 8b4978f commit e9a3918

File tree

6 files changed

+29
-38
lines changed

6 files changed

+29
-38
lines changed

src/CacheMap.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ public function count(): int
7070
/**
7171
* Returns the index of the value from the cache array with the given key.
7272
*
73-
* @param mixed $cacheKey
74-
*
73+
* @param mixed $cacheKey
7574
* @return mixed
7675
*/
7776
private function findCacheIndexByKey($cacheKey)

src/CacheMapInterface.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,24 @@ interface CacheMapInterface
1010
* Returns the given entry from cache with the given key.
1111
* Returns false if no entry with the key is found.
1212
*
13-
* @param mixed $key
14-
*
13+
* @param mixed $key
1514
* @return bool|mixed
1615
*/
1716
public function get($key);
1817

1918
/**
2019
* Sets the cache with the given key and value.
2120
*
22-
* @param mixed $key
23-
* @param mixed $value
24-
*
21+
* @param mixed $key
22+
* @param mixed $value
2523
* @return void
2624
*/
2725
public function set($key, $value): void;
2826

2927
/**
3028
* Deletes the cache entry with the given key.
3129
*
32-
* @param mixed $key
33-
*
30+
* @param mixed $key
3431
* @return void
3532
*/
3633
public function delete($key): void;

src/DataLoader.php

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ final class DataLoader implements DataLoaderInterface
2929
/**
3030
* Initiates a new DataLoader.
3131
*
32-
* @param callable $batchLoadFunction The function which will be called for the batch loading.
33-
* It must accept an array of keys and returns a Promise which resolves to an array of values.
34-
* @param LoopInterface $loop
35-
* @param CacheMapInterface $cacheMap
36-
* @param null|DataLoaderOptions $options
32+
* @param callable $batchLoadFunction The function which will be called for the batch loading.
33+
* It must accept an array of keys and returns a Promise which resolves to an array of values.
34+
* @param LoopInterface $loop
35+
* @param CacheMapInterface $cacheMap
36+
* @param null|DataLoaderOptions $options
3737
*/
3838
public function __construct(
3939
callable $batchLoadFunction,
@@ -166,7 +166,7 @@ private function dispatchQueue(): void
166166
/**
167167
* Dispatches a batch of a queue. The given batch can also be the whole queue.
168168
*
169-
* @param array $batch
169+
* @param array $batch
170170
*/
171171
private function dispatchQueueBatch($batch)
172172
{
@@ -195,9 +195,8 @@ function ($values) use ($batch, $keys) {
195195
/**
196196
* Dispatches the given queue in multiple batches.
197197
*
198-
* @param array $queue
199-
* @param int $maxBatchSize
200-
*
198+
* @param array $queue
199+
* @param int $maxBatchSize
201200
* @return void
202201
*/
203202
private function dispatchQueueInMultipleBatches(array $queue, $maxBatchSize): void
@@ -214,8 +213,8 @@ private function dispatchQueueInMultipleBatches(array $queue, $maxBatchSize): vo
214213
/**
215214
* Handles the batch by resolving the promises and rejecting ones that return Exceptions.
216215
*
217-
* @param array $batch
218-
* @param array $values
216+
* @param array $batch
217+
* @param array $values
219218
*/
220219
private function handleSuccessfulDispatch(array $batch, array $values): void
221220
{
@@ -230,8 +229,8 @@ private function handleSuccessfulDispatch(array $batch, array $values): void
230229
/**
231230
* Handles the failed batch dispatch.
232231
*
233-
* @param array $batch
234-
* @param \Exception $error
232+
* @param array $batch
233+
* @param \Exception $error
235234
*/
236235
private function handleFailedDispatch(array $batch, \Exception $error)
237236
{
@@ -245,8 +244,8 @@ private function handleFailedDispatch(array $batch, \Exception $error)
245244
/**
246245
* Validates the batch promise's output.
247246
*
248-
* @param array $values Values from resolved promise.
249-
* @param array $keys Keys which the DataLoaders load was called with
247+
* @param array $values Values from resolved promise.
248+
* @param array $keys Keys which the DataLoaders load was called with
250249
*
251250
* @throws DataLoaderException
252251
*/

src/DataLoaderInterface.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ interface DataLoaderInterface
1212
/**
1313
* Returns a Promise for the value represented by the given key.
1414
*
15-
* @param mixed $key
16-
*
15+
* @param mixed $key
1716
* @return ExtendedPromiseInterface
17+
*
1818
* @throws \InvalidArgumentException
1919
*/
2020
public function load($key): ExtendedPromiseInterface;
@@ -29,18 +29,17 @@ public function load($key): ExtendedPromiseInterface;
2929
* $dataLoader->load('b');
3030
* });
3131
*
32-
* @param array $keys
33-
*
32+
* @param array $keys
3433
* @return ExtendedPromiseInterface
34+
*
3535
* @throws \InvalidArgumentException
3636
*/
3737
public function loadMany(array $keys): ExtendedPromiseInterface;
3838

3939
/**
4040
* Clears the value for the given key from the cache if it exists.
4141
*
42-
* @param int|string $key
43-
*
42+
* @param int|string $key
4443
* @return void
4544
*/
4645
public function clear($key): void;
@@ -55,9 +54,8 @@ public function clearAll(): void;
5554
/**
5655
* Adds the given key and value to the cache. If the key already exists no change is made.
5756
*
58-
* @param int|string $key
59-
* @param int|string $value
60-
*
57+
* @param int|string $key
58+
* @param int|string $value
6159
* @return void
6260
*/
6361
public function prime($key, $value): void;

tests/Unit/DataLoaderAbuseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function batch_function_must_promise_an_array_of_correct_length()
210210
* Creates a simple DataLoader.
211211
*
212212
* @param $batchLoadFunction
213-
* @param array $options
213+
* @param array $options
214214
* @return DataLoader
215215
*/
216216
private function createDataLoader($batchLoadFunction, $options = null)

tests/Unit/DataLoaderTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,7 @@ function ($keys) use (&$bLoadCalls, $deepLoader) {
857857
/**
858858
* Creates a simple DataLoader which returns the given keys as values.
859859
*
860-
* @param array $options
861-
*
860+
* @param array $options
862861
* @return DataLoader
863862
*/
864863
private function createIdentityLoader($options = null)
@@ -877,8 +876,7 @@ function ($keys) {
877876
/**
878877
* Creates a simple DataLoader which returns the given keys as values.
879878
*
880-
* @param array $options
881-
*
879+
* @param array $options
882880
* @return DataLoader
883881
*/
884882
private function createEvenLoader($options = null)

0 commit comments

Comments
 (0)