Skip to content

Commit 0e997bf

Browse files
committed
simplify README
1 parent 59e1ec0 commit 0e997bf

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

README.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,6 @@ $newBalance = $mutex->check(static function () use ($bankAccount, $amount): bool
115115

116116
return $balance;
117117
});
118-
119-
if (!$newBalance) {
120-
if ($balance < 0) {
121-
throw new \DomainException('You have no credit');
122-
}
123-
}
124118
```
125119

126120
### LockReleaseException::getCode{Exception, Result}()
@@ -134,7 +128,6 @@ In order to read the code result (or an exception thrown there),
134128
Example:
135129
```php
136130
try {
137-
// OR $mutex->check(...)
138131
$result = $mutex->synchronized(static function () {
139132
if (someCondition()) {
140133
throw new \DomainException();
@@ -144,14 +137,11 @@ try {
144137
});
145138
} catch (LockReleaseException $e) {
146139
if ($e->getCodeException() !== null) {
147-
$codeException = $e->getCodeException();
148-
// do something with the code exception
140+
// do something with the $e->getCodeException() exception
149141
} else {
150-
$codeResult = $e->getCodeResult();
151-
// do something with the code result
142+
// do something with the $e->getCodeResult() result
152143
}
153144

154-
// deal with LockReleaseException or propagate it
155145
throw $e;
156146
}
157147
```

0 commit comments

Comments
 (0)