File tree Expand file tree Collapse file tree 1 file changed +2
-12
lines changed Expand file tree Collapse file tree 1 file changed +2
-12
lines changed Original file line number Diff line number Diff line change @@ -115,12 +115,6 @@ $newBalance = $mutex->check(static function () use ($bankAccount, $amount): bool
115
115
116
116
return $balance;
117
117
});
118
-
119
- if (!$newBalance) {
120
- if ($balance < 0) {
121
- throw new \DomainException('You have no credit');
122
- }
123
- }
124
118
```
125
119
126
120
### LockReleaseException::getCode{Exception, Result}()
@@ -134,7 +128,6 @@ In order to read the code result (or an exception thrown there),
134
128
Example:
135
129
``` php
136
130
try {
137
- // OR $mutex->check(...)
138
131
$result = $mutex->synchronized(static function () {
139
132
if (someCondition()) {
140
133
throw new \DomainException();
@@ -144,14 +137,11 @@ try {
144
137
});
145
138
} catch (LockReleaseException $e) {
146
139
if ($e->getCodeException() !== null) {
147
- $codeException = $e->getCodeException();
148
- // do something with the code exception
140
+ // do something with the $e->getCodeException() exception
149
141
} else {
150
- $codeResult = $e->getCodeResult();
151
- // do something with the code result
142
+ // do something with the $e->getCodeResult() result
152
143
}
153
144
154
- // deal with LockReleaseException or propagate it
155
145
throw $e;
156
146
}
157
147
```
You can’t perform that action at this time.
0 commit comments