Skip to content

Commit ebf6f0f

Browse files
committed
Merge branch 'master' of github.com:lordthorzonus/php-dataloader
* 'master' of github.com:lordthorzonus/php-dataloader: Fix readme Fix DataLoaderInterface comments Update CHANGELOG.md Update .scrutinizer.yml Update .scrutinizer.yml Apply fixes from StyleCI Update CHANGELOG.md Update travis to only run on newest php version
2 parents d888a3a + a0576ac commit ebf6f0f

12 files changed

+36
-31
lines changed

.scrutinizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build:
99
tests:
1010
override:
1111
-
12-
command: 'phpunit --coverage-clover=coverage.clover'
12+
command: 'vendor/bin/phpunit --coverage-clover=coverage.clover'
1313
coverage:
1414
file: 'coverage.clover'
1515
format: 'php-clover'

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
## Updating from 1.0.0 to 2.0.0
44
- Overall php version requirement was bumped from `5.5` to `7.4`
5-
- Bumped version requirements for React dependencies and switched DataLoader to return ExtendedPromiseInterfaces instead of PromiseInterfaces.
6-
- Fluent interfaces in `Dataloader::prime()`,`DataLoader::clear` and `DataLoader::clearAll()` were removed. So change usages like:
5+
- ReactPHP dependencies have been bumped to their latest versions.
6+
- DataloaderInterface now returns ExtendedPromiseInterfaces instead of PromiseInterfaces.
7+
- Fluent interfaces from `Dataloader::prime()`,`DataLoader::clear()` and `DataLoader::clearAll()` were removed. So change usages like:
78
```php
89
$dataloader->clear('A')->prime('A', 'Y');
910
```
@@ -12,4 +13,4 @@
1213
$dataloader->clear('A');
1314
$dataloader->prime('A', 'Y');
1415
```
15-
- All classes in the library have been marked as final.
16+
- All classes in the library have been marked as final.

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,16 @@ $promises = \React\Promise\all([
172172

173173
### `clear($key)`
174174

175-
Clears the value at `$key` from the cache, if it exists. Returns itself for
176-
method chaining.
175+
Clears the value at `$key` from the cache, if it exists.
177176

178177
- `@param mixed key: An key value to clear.`
179178

180179
### `clearAll()`
181180

182-
Clears the entire cache. Returns itself for method chaining.
181+
Clears the entire cache.
183182

184183
### `prime($key, $value)`
185184

186185
Primes the cache with the provided key and value. If the key already exists, no
187186
change is made. (To forcefully prime the cache, clear the key first with
188-
`$loader->clear($key)->prime($key, $value)`. Returns itself for method chaining.
189-
190-
191-
187+
`$loader->clear($key)->prime($key, $value)`.

src/CacheMap.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace leinonen\DataLoader;
46

src/CacheMapInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace leinonen\DataLoader;
46

src/DataLoader.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace leinonen\DataLoader;
46

5-
use function React\Promise\all;
6-
use React\Promise\ExtendedPromiseInterface;
77
use React\Promise\Promise;
8-
use React\EventLoop\LoopInterface;
8+
use function React\Promise\all;
99
use function React\Promise\reject;
10+
use React\EventLoop\LoopInterface;
1011
use function React\Promise\resolve;
12+
use React\Promise\ExtendedPromiseInterface;
1113

1214
final class DataLoader implements DataLoaderInterface
1315
{

src/DataLoaderException.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace leinonen\DataLoader;
46

src/DataLoaderInterface.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace leinonen\DataLoader;
46

5-
use React\Promise\ExtendedPromiseInterface;
67
use React\Promise\Promise;
7-
8+
use React\Promise\ExtendedPromiseInterface;
89

910
interface DataLoaderInterface
1011
{
@@ -36,7 +37,7 @@ public function load($key): ExtendedPromiseInterface;
3637
public function loadMany(array $keys): ExtendedPromiseInterface;
3738

3839
/**
39-
* Clears the value for the given key from the cache if it exists. Returns itself for method chaining.
40+
* Clears the value for the given key from the cache if it exists.
4041
*
4142
* @param int|string $key
4243
*
@@ -45,15 +46,14 @@ public function loadMany(array $keys): ExtendedPromiseInterface;
4546
public function clear($key): void;
4647

4748
/**
48-
* Clears the entire cache. Returns itself for method chaining.
49+
* Clears the entire cache.
4950
*
5051
* @return void
5152
*/
5253
public function clearAll(): void;
5354

5455
/**
5556
* Adds the given key and value to the cache. If the key already exists no change is made.
56-
* Returns itself for method chaining.
5757
*
5858
* @param int|string $key
5959
* @param int|string $value

tests/Unit/CacheMapTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace leinonen\DataLoader\Tests\Unit;
44

5-
use leinonen\DataLoader\CacheMap;
65
use PHPUnit\Framework\TestCase;
6+
use leinonen\DataLoader\CacheMap;
77

88
class CacheMapTest extends TestCase
99
{

tests/Unit/DataLoaderAbuseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
use React\Promise\Promise;
66
use React\EventLoop\Factory;
7+
use PHPUnit\Framework\TestCase;
78
use leinonen\DataLoader\CacheMap;
89
use React\EventLoop\LoopInterface;
10+
use function React\Promise\resolve;
911
use leinonen\DataLoader\DataLoader;
1012
use leinonen\DataLoader\DataLoaderException;
11-
use PHPUnit\Framework\TestCase;
12-
use function React\Promise\resolve;
1313

1414
class DataLoaderAbuseTest extends TestCase
1515
{

0 commit comments

Comments
 (0)