|
|
@@ -109,13 +109,13 @@ class EventManager implements EventManagerInterface
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- if (!$callable && !is_callable($options)) {
|
|
|
+ if ($callable === null && !is_callable($options)) {
|
|
|
throw new InvalidArgumentException(
|
|
|
'Second argument of `EventManager::on()` must be a callable if `$callable` is null.'
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- if (!$callable) {
|
|
|
+ if ($callable === null) {
|
|
|
/** @var callable $options */
|
|
|
$this->_listeners[$eventKey][static::$defaultPriority][] = [
|
|
|
'callable' => $options(...),
|
|
|
@@ -124,6 +124,7 @@ class EventManager implements EventManagerInterface
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
+ /** @var array $options */
|
|
|
$priority = $options['priority'] ?? static::$defaultPriority;
|
|
|
$this->_listeners[$eventKey][$priority][] = [
|
|
|
'callable' => $callable(...),
|