1414namespace PhalconKit \Events ;
1515
1616use Phalcon \Di \Di ;
17- use Phalcon \Events \ManagerInterface ;
17+ use Phalcon \Contracts \ Events \Manager as EventsManagerContract ;
1818use PhalconKit \Exception \InvalidArgumentException ;
1919use PhalconKit \Support \Helper ;
2020use PhalconKit \Support \Slug ;
@@ -34,20 +34,20 @@ trait EventsAwareTrait
3434 /**
3535 * The event manager responsible for handling and triggering events.
3636 */
37- protected ?ManagerInterface $ eventsManager ;
37+ protected ?EventsManagerContract $ eventsManager ;
3838
3939 /**
4040 * Set the events manager
4141 */
42- public function setEventsManager (ManagerInterface $ manager ): void
42+ public function setEventsManager (EventsManagerContract $ manager ): void
4343 {
4444 $ this ->eventsManager = $ manager ;
4545 }
4646
4747 /**
4848 * Get the events manager.
4949 */
50- public function getEventsManager (): ?ManagerInterface
50+ public function getEventsManager (): ?EventsManagerContract
5151 {
5252 $ this ->eventsManager ??= Di::getDefault ()->get ('eventsManager ' );
5353 return $ this ->eventsManager ;
@@ -101,8 +101,10 @@ public function fire(string $task, mixed $data = null, bool $cancelable = false)
101101 $ eventType = $ this ->getEventsPrefix () . ': ' . $ task ;
102102 $ eventsManager = $ this ->getEventsManager ();
103103
104- if (!$ eventsManager instanceof ManagerInterface) {
105- throw new InvalidArgumentException ("Events manager must be an instance of ' " . ManagerInterface::class . "'. " );
104+ if (!$ eventsManager instanceof EventsManagerContract) {
105+ throw new InvalidArgumentException (
106+ "Events manager must be an instance of ' " . EventsManagerContract::class . "'. "
107+ );
106108 }
107109
108110 return $ eventsManager ->fire ($ eventType , $ this , $ data , $ cancelable );
0 commit comments