Skip to content

Commit 67419c6

Browse files
Use typed properties in tests as much as possible
1 parent 58817d8 commit 67419c6

7 files changed

+13
-19
lines changed

Tests/LockTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,8 @@ public function testAcquireReadTwiceWithExpiration()
469469
$key = new Key(uniqid(__METHOD__, true));
470470
$store = new class() implements PersistingStoreInterface {
471471
use ExpiringStoreTrait;
472-
private $keys = [];
473-
private $initialTtl = 30;
472+
private array $keys = [];
473+
private int $initialTtl = 30;
474474

475475
public function save(Key $key): void
476476
{
@@ -513,8 +513,8 @@ public function testAcquireTwiceWithExpiration()
513513
$key = new Key(uniqid(__METHOD__, true));
514514
$store = new class() implements PersistingStoreInterface {
515515
use ExpiringStoreTrait;
516-
private $keys = [];
517-
private $initialTtl = 30;
516+
private array $keys = [];
517+
private int $initialTtl = 30;
518518

519519
public function save(Key $key): void
520520
{

Tests/Store/AbstractRedisStoreTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function testBackwardCompatibility()
5656

5757
class Symfony51Store
5858
{
59-
private $redis;
59+
private \Redis|Relay|\RedisCluster|\RedisArray|\Predis\ClientInterface $redis;
6060

6161
public function __construct($redis)
6262
{

Tests/Store/CombinedStoreTest.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,10 @@ public function getStore(): PersistingStoreInterface
5050
return new CombinedStore([new RedisStore($redis)], new UnanimousStrategy());
5151
}
5252

53-
/** @var MockObject&StrategyInterface */
54-
private $strategy;
55-
/** @var MockObject&BlockingStoreInterface */
56-
private $store1;
57-
/** @var MockObject&BlockingStoreInterface */
58-
private $store2;
59-
/** @var CombinedStore */
60-
private $store;
53+
private MockObject&StrategyInterface $strategy;
54+
private MockObject&BlockingStoreInterface $store1;
55+
private MockObject&BlockingStoreInterface $store2;
56+
private CombinedStore $store;
6157

6258
protected function setUp(): void
6359
{

Tests/Store/DoctrineDbalStoreTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class DoctrineDbalStoreTest extends AbstractStoreTestCase
3333
{
3434
use ExpiringStoreTestTrait;
3535

36-
protected static $dbFile;
36+
protected static string $dbFile;
3737

3838
public static function setUpBeforeClass(): void
3939
{

Tests/Store/PdoStoreTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class PdoStoreTest extends AbstractStoreTestCase
2727
{
2828
use ExpiringStoreTestTrait;
2929

30-
protected static $dbFile;
30+
protected static string $dbFile;
3131

3232
public static function setUpBeforeClass(): void
3333
{

Tests/Strategy/ConsensusStrategyTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
*/
2020
class ConsensusStrategyTest extends TestCase
2121
{
22-
/** @var ConsensusStrategy */
23-
private $strategy;
22+
private ConsensusStrategy $strategy;
2423

2524
protected function setUp(): void
2625
{

Tests/Strategy/UnanimousStrategyTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
*/
2020
class UnanimousStrategyTest extends TestCase
2121
{
22-
/** @var UnanimousStrategy */
23-
private $strategy;
22+
private UnanimousStrategy $strategy;
2423

2524
protected function setUp(): void
2625
{

0 commit comments

Comments
 (0)