Skip to content

Commit

Permalink
Update to require Promise v3
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Dec 21, 2023
1 parent cfd3e05 commit dc6bb28
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"clue/redis-protocol": "0.3.*",
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
"react/event-loop": "^1.2",
"react/promise": "^3 || ^2.0 || ^1.1",
"react/promise": "^3",
"react/promise-timer": "^1.10",
"react/socket": "^1.15"
},
Expand Down
3 changes: 0 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ parameters:
- src/
- tests/

reportUnmatchedIgnoredErrors: false
ignoreErrors:
# ignore generic usage like `PromiseInterface<T>` for Promise v2/v1
- '/^PHPDoc tag @return contains generic type React\\Promise\\PromiseInterface<.+> but interface React\\Promise\\PromiseInterface is not generic\.$/'
# ignore undefined methods due to magic `__call()` method
- '/^Call to an undefined method Clue\\React\\Redis\\RedisClient::.+\(\)\.$/'
- '/^Call to an undefined method Clue\\React\\Redis\\Io\\StreamingClient::.+\(\)\.$/'
9 changes: 4 additions & 5 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Clue\Tests\React\Redis;

use PHPUnit\Framework\MockObject\MockBuilder;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase as BaseTestCase;
use React\Promise\PromiseInterface;
Expand Down Expand Up @@ -39,12 +38,12 @@ protected function expectCallableNever(): callable

protected function createCallableMock(): MockObject
{
if (method_exists(MockBuilder::class, 'addMethods')) {
// @phpstan-ignore-next-line requires PHPUnit 9+
return $this->getMockBuilder(\stdClass::class)->addMethods(['__invoke'])->getMock();
$builder = $this->getMockBuilder(\stdClass::class);
if (method_exists($builder, 'addMethods')) {
return $builder->addMethods(['__invoke'])->getMock();
} else {
// legacy PHPUnit < 9
return $this->getMockBuilder(\stdClass::class)->setMethods(['__invoke'])->getMock();
return $builder->setMethods(['__invoke'])->getMock();
}
}

Expand Down

0 comments on commit dc6bb28

Please sign in to comment.