We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7a70b43 commit c33d68bCopy full SHA for c33d68b
1 file changed
src/HandlerExceptionDeclarator/PublicCallbackDeclarator.php
@@ -7,8 +7,8 @@
7
8
class PublicCallbackDeclarator implements HandlerExceptionDeclaratorInterface
9
{
10
- /** @var callable $callback */
11
- private $callback;
+ /** @var callable|null $callback */
+ private $callback = null;
12
13
public function initHandler(callable $callback): void
14
@@ -17,6 +17,10 @@ public function initHandler(callable $callback): void
17
18
public function getCallback(): callable
19
20
+ if (is_null($this->callback)) {
21
+ throw new \LogicException('Callback still not initialized. Please call `getCallback` method after `initHandler`');
22
+ }
23
+
24
return $this->callback;
25
}
26
0 commit comments