Refactor customized async event listener
- Remove method:
Listener::__construct(Event $event)
. - Change method:
Listener::handle()
toListener::handle(Event $event)
. - Return
false
tostop propagating the event to subsequent listeners
in Listener::handle().
Before:
abstract class Listener
{
protected $event;
public function __construct(Event $event)
{
$this->event = $event;
}
/**
* The logic of handling event
* @return void
*/
abstract public function handle();
}
Now:
abstract class Listener
{
/**
* The logic of handling event
* @param Event $event
* @return mixed
*/
abstract public function handle(Event $event);
}