Skip to content

Commit 4e18a0d

Browse files
committed
Declare strict types
1 parent a98afa2 commit 4e18a0d

16 files changed

+34
-12
lines changed

.php-cs-fixer.dist.php

+1-9
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,12 @@
5555
'return_assignment' => false,
5656
'comment_to_phpdoc' => false,
5757
'general_phpdoc_annotation_remove' => [
58-
'annotations' => ['author', 'copyright', 'throws'],
58+
'annotations' => ['author', 'copyright'],
5959
],
6060

6161
// fn => without curly brackets is less readable,
6262
// also prevent bounding of unwanted variables for GC
6363
'use_arrow_functions' => false,
64-
65-
// TODO disable too strict rules for now
66-
'declare_strict_types' => false,
67-
'general_phpdoc_annotation_remove' => false,
68-
'php_unit_data_provider_static' => false,
69-
'php_unit_strict' => false,
70-
'phpdoc_to_comment' => false,
71-
'strict_comparison' => false,
7264
])
7365
->setFinder($finder)
7466
->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer.' . md5(__DIR__) . '.cache');

tests/mutex/CASMutexTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace malkusch\lock\Tests\mutex;
46

57
use malkusch\lock\exception\LockAcquireException;

tests/mutex/FlockMutexTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace malkusch\lock\Tests\mutex;
46

57
use Eloquent\Liberator\Liberator;

tests/mutex/LockMutexTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace malkusch\lock\Tests\mutex;
46

57
use malkusch\lock\exception\LockAcquireException;

tests/mutex/MemcachedMutexTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace malkusch\lock\Tests\mutex;
46

57
use malkusch\lock\exception\LockReleaseException;

tests/mutex/MutexConcurrencyTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace malkusch\lock\Tests\mutex;
46

57
use Eloquent\Liberator\Liberator;

tests/mutex/MutexTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace malkusch\lock\Tests\mutex;
46

57
use Eloquent\Liberator\Liberator;

tests/mutex/PHPRedisMutexTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace malkusch\lock\Tests\mutex;
46

57
use malkusch\lock\exception\LockAcquireException;

tests/mutex/PgAdvisoryLockMutexTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace malkusch\lock\Tests\mutex;
46

57
use malkusch\lock\mutex\PgAdvisoryLockMutex;

tests/mutex/PredisMutexTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace malkusch\lock\Tests\mutex;
46

57
use malkusch\lock\exception\LockAcquireException;

tests/mutex/RedisMutexTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace malkusch\lock\Tests\mutex;
46

57
use malkusch\lock\exception\LockAcquireException;

tests/mutex/SpinlockMutexTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace malkusch\lock\Tests\mutex;
46

57
use malkusch\lock\exception\ExecutionOutsideLockException;

tests/mutex/TransactionalMutexTest.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace malkusch\lock\Tests\mutex;
46

57
use malkusch\lock\exception\LockAcquireException;
@@ -81,7 +83,7 @@ public function testExceptionRollsback(): void
8183
}
8284

8385
$count = $pdo->query('SELECT count(*) FROM testExceptionRollsback')->fetchColumn();
84-
self::assertEquals(0, $count);
86+
self::assertSame(0, \PHP_VERSION_ID < 8_01_00 ? (int) $count : $count);
8587
}
8688

8789
/**
@@ -123,7 +125,7 @@ public function testReplayTransaction(\Exception $exception): void
123125
++$i;
124126

125127
$count = $pdo->query('SELECT count(*) FROM testExceptionRollsback')->fetchColumn();
126-
self::assertEquals(0, $count);
128+
self::assertSame(0, \PHP_VERSION_ID < 8_01_00 ? (int) $count : $count);
127129

128130
$pdo->exec('INSERT INTO testExceptionRollsback VALUES(1)');
129131

@@ -134,7 +136,7 @@ public function testReplayTransaction(\Exception $exception): void
134136
});
135137

136138
$count = $pdo->query('SELECT count(*) FROM testExceptionRollsback')->fetchColumn();
137-
self::assertEquals(1, $count);
139+
self::assertSame(1, \PHP_VERSION_ID < 8_01_00 ? (int) $count : $count);
138140

139141
self::assertSame(5, $i);
140142
}

tests/util/DoubleCheckedLockingTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace malkusch\lock\Tests\util;
46

57
use malkusch\lock\mutex\Mutex;

tests/util/LoopTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace malkusch\lock\Tests\util;
46

57
use malkusch\lock\exception\TimeoutException;

tests/util/PcntlTimeoutTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace malkusch\lock\Tests\util;
46

57
use malkusch\lock\exception\DeadlineException;

0 commit comments

Comments
 (0)