Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0930009

Browse files
author
Anton Komarev
committed
Code style
1 parent 45a0f4a commit 0930009

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

‎src/LockId/PostgresLockId.php‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,17 @@
1717

1818
final class PostgresLockId
1919
{
20-
private const DB_INT_VALUE_MIN = 0;
21-
private const DB_INT_VALUE_MAX = 9223372036854775807;
22-
private const DB_INT32_VALUE_MAX = 2147483647;
20+
private const DB_INT64_VALUE_MIN = 0;
21+
private const DB_INT64_VALUE_MAX = 9223372036854775807;
2322

2423
public function __construct(
2524
public readonly int $id,
2625
public readonly string $humanReadableValue = '',
2726
) {
28-
if ($id < self::DB_INT_VALUE_MIN) {
27+
if ($id < self::DB_INT64_VALUE_MIN) {
2928
throw new InvalidArgumentException('Out of bound exception (id is too small)');
3029
}
31-
if ($id > self::DB_INT_VALUE_MAX) {
30+
if ($id > self::DB_INT64_VALUE_MAX) {
3231
throw new InvalidArgumentException('Out of bound exception (id is too big)');
3332
}
3433
}

‎test/Integration/Locker/PostgresAdvisoryLockerTest.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
final class PostgresAdvisoryLockerTest extends AbstractIntegrationTestCase
2323
{
24-
private const MIN_DB_INT_VALUE = 0;
25-
private const MAX_DB_INT_VALUE = 9223372036854775807;
24+
private const DB_INT64_VALUE_MIN = 0;
25+
private const DB_INT64_VALUE_MAX = 9223372036854775807;
2626

2727
public function test_it_can_acquire_lock(): void
2828
{
@@ -41,7 +41,7 @@ public function test_it_can_acquire_lock_with_smallest_lock_id(): void
4141
{
4242
$locker = $this->initLocker();
4343
$dbConnection = $this->initPostgresPdoConnection();
44-
$postgresLockId = new PostgresLockId(self::MIN_DB_INT_VALUE);
44+
$postgresLockId = new PostgresLockId(self::DB_INT64_VALUE_MIN);
4545

4646
$isLockAcquired = $locker->acquireLock($dbConnection, $postgresLockId);
4747

@@ -54,7 +54,7 @@ public function test_it_can_acquire_lock_with_biggest_lock_id(): void
5454
{
5555
$locker = $this->initLocker();
5656
$dbConnection = $this->initPostgresPdoConnection();
57-
$postgresLockId = new PostgresLockId(self::MAX_DB_INT_VALUE);
57+
$postgresLockId = new PostgresLockId(self::DB_INT64_VALUE_MAX);
5858

5959
$isLockAcquired = $locker->acquireLock($dbConnection, $postgresLockId);
6060

‎test/Unit/LockId/PostgresLockIdTest.php‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@
1919

2020
final class PostgresLockIdTest extends AbstractUnitTestCase
2121
{
22-
private const MIN_DB_INT_VALUE = 0;
23-
private const MAX_DB_INT_VALUE = 9223372036854775807;
22+
private const DB_INT64_VALUE_MIN = 0;
23+
private const DB_INT64_VALUE_MAX = 9223372036854775807;
2424

2525
public function test_it_can_create_postgres_lock_id_with_min_id(): void
2626
{
27-
$lockId = new PostgresLockId(self::MIN_DB_INT_VALUE);
27+
$lockId = new PostgresLockId(self::DB_INT64_VALUE_MIN);
2828

29-
$this->assertSame(self::MIN_DB_INT_VALUE, $lockId->id);
29+
$this->assertSame(self::DB_INT64_VALUE_MIN, $lockId->id);
3030
}
3131

3232
public function test_it_can_create_postgres_lock_id_with_max_id(): void
3333
{
34-
$lockId = new PostgresLockId(self::MAX_DB_INT_VALUE);
34+
$lockId = new PostgresLockId(self::DB_INT64_VALUE_MAX);
3535

36-
$this->assertSame(self::MAX_DB_INT_VALUE, $lockId->id);
36+
$this->assertSame(self::DB_INT64_VALUE_MAX, $lockId->id);
3737
}
3838

3939
public function test_it_can_create_postgres_lock_id_from_lock_id(): void

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /