diff --git a/EventListener.php b/EventListener.php index e237e41..997724d 100644 --- a/EventListener.php +++ b/EventListener.php @@ -29,8 +29,11 @@ readonly class EventListener implements InjectTargetInterface { // TODO: Implement dispatch() method. $target = \Kiri::getDi()->getReflectionClass($class)->newInstanceWithoutConstructor(); - - on($this->event, [$target, "onHandler"]); + + if (!($target instanceof EventInterface)) { + throw new Exception("Event listen must implement " . EventInterface::class); + } + on($this->event, [$target, "process"]); } -} \ No newline at end of file +}