@@ -20,7 +20,7 @@ class DoubleCheckedLocking
2020 private $ mutex ;
2121
2222 /**
23- * @var callable The check.
23+ * @var callable(): bool The check.
2424 */
2525 private $ check ;
2626
@@ -29,7 +29,7 @@ class DoubleCheckedLocking
2929 *
3030 * @param \malkusch\lock\mutex\Mutex $mutex Provides methods for exclusive
3131 * code execution.
32- * @param callable $check Callback that decides if the lock should be
32+ * @param callable(): bool $check Callback that decides if the lock should be
3333 * acquired and if the critical code callback should be executed after
3434 * acquiring the lock.
3535 */
@@ -48,7 +48,8 @@ public function __construct(Mutex $mutex, callable $check)
4848 * critical code callback to indicate that processing did not occure or has
4949 * failed. It is up to the user to decide the last point.
5050 *
51- * @param callable $code The critical code callback.
51+ * @template T
52+ * @param callable(): T $code The critical code callback.
5253 * @throws \Exception The execution callback or the check threw an
5354 * exception.
5455 * @throws \malkusch\lock\exception\LockAcquireException The mutex could not
@@ -57,7 +58,7 @@ public function __construct(Mutex $mutex, callable $check)
5758 * be released.
5859 * @throws \malkusch\lock\exception\ExecutionOutsideLockException Some code
5960 * has been executed outside of the lock.
60- * @return mixed Boolean false if check did not pass or mixed for what ever
61+ * @return T|false Boolean false if check did not pass or mixed for what ever
6162 * the critical code callback returns.
6263 */
6364 public function then (callable $ code )
0 commit comments