Skip to content

Commit 0a477c3

Browse files
committed
Leave only *Handler API
1 parent 8cf8014 commit 0a477c3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,18 @@ $dbConnection = new PDO($dsn, $username, $password);
6262
$locker = new \Cog\DbLocker\Postgres\PostgresAdvisoryLocker();
6363
$lockId = \Cog\DbLocker\Postgres\PostgresLockKey::create('user', '4');
6464

65-
$lock = $locker->withinSessionLevelLock(
65+
$payment = $locker->withinSessionLevelLock(
6666
$dbConnection,
6767
$lockId,
68-
function (\Cog\DbLocker\Postgres\LockHandle\SessionLevelLockHandle $lock): Payment {
68+
function (
69+
\Cog\DbLocker\Postgres\LockHandle\SessionLevelLockHandle $lock,
70+
): Payment { // Define a type of $payment variable, and it will be resolved by analyzers
6971
if ($lock->wasAcquired) {
7072
// Execute logic if lock was successful
7173
} else {
7274
// Execute logic if lock acquisition has been failed
7375
}
74-
}
76+
},
7577
\Cog\DbLocker\Postgres\Enum\PostgresLockWaitModeEnum::NonBlocking,
7678
\Cog\DbLocker\Postgres\Enum\PostgresLockAccessModeEnum::Exclusive,
7779
);

0 commit comments

Comments
 (0)