Skip to content

Commit d1b2453

Browse files
authored
Unify lock/unlock methods visibility (#62)
1 parent 70fd6d9 commit d1b2453

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/mutex/MySQLMutex.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(\PDO $PDO, string $name, float $timeout = 0)
3030
}
3131

3232
#[\Override]
33-
public function lock(): void
33+
protected function lock(): void
3434
{
3535
$statement = $this->pdo->prepare('SELECT GET_LOCK(?, ?)');
3636

@@ -62,7 +62,7 @@ public function lock(): void
6262
}
6363

6464
#[\Override]
65-
public function unlock(): void
65+
protected function unlock(): void
6666
{
6767
$statement = $this->pdo->prepare('DO RELEASE_LOCK(?)');
6868
$statement->execute([

src/mutex/PgAdvisoryLockMutex.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(\PDO $PDO, string $name)
3131
}
3232

3333
#[\Override]
34-
public function lock(): void
34+
protected function lock(): void
3535
{
3636
$statement = $this->pdo->prepare('SELECT pg_advisory_lock(?, ?)');
3737

@@ -42,7 +42,7 @@ public function lock(): void
4242
}
4343

4444
#[\Override]
45-
public function unlock(): void
45+
protected function unlock(): void
4646
{
4747
$statement = $this->pdo->prepare('SELECT pg_advisory_unlock(?, ?)');
4848
$statement->execute([

tests/mutex/PgAdvisoryLockMutexTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function testAcquireLock(): void
6161
)
6262
);
6363

64-
$this->mutex->lock();
64+
\Closure::bind(static fn ($mutex) => $mutex->lock(), null, PgAdvisoryLockMutex::class)($this->mutex);
6565
}
6666

6767
public function testReleaseLock(): void
@@ -95,6 +95,6 @@ public function testReleaseLock(): void
9595
)
9696
);
9797

98-
$this->mutex->unlock();
98+
\Closure::bind(static fn ($mutex) => $mutex->unlock(), null, PgAdvisoryLockMutex::class)($this->mutex);
9999
}
100100
}

0 commit comments

Comments
 (0)