Skip to content

Commit

Permalink
Change default value for event params to better infer default type
Browse files Browse the repository at this point in the history
Signed-off-by: Villermen <villermen@gmail.com>
  • Loading branch information
villermen committed Nov 14, 2022
1 parent 908f7aa commit 7547621
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@ class Event implements EventInterface
*
* Accept a target and its parameters.
*
* TODO: Adding @psalm-this-out annotations here seems to only confuse Psalm into typing <mixed, mixed>, meaning
* setTarget() and setParams() will have to always be called for Psalm to understand the typing situation.
*
* @param string|null $name Event name
* @param string|object|null $target
* @psalm-param TTarget $target
* @param array|ArrayAccess|object|null $params
* @psalm-param TParams|null $params
*/
public function __construct($name = null, $target = null, $params = null)
public function __construct($name = null, $target = null, $params = [])
{
if (null !== $name) {
$this->setName($name);
Expand All @@ -66,7 +65,7 @@ public function __construct($name = null, $target = null, $params = null)
$this->setTarget($target);
}

if (null !== $params) {
if (! empty($params)) {
$this->setParams($params);
}
}
Expand Down

0 comments on commit 7547621

Please sign in to comment.