implement GenericEvent
This commit is contained in:
+8
-1
@@ -14,5 +14,12 @@
|
||||
}
|
||||
],
|
||||
"minimum-stability": "stable",
|
||||
"require": {}
|
||||
"require": {
|
||||
"league/event": ">=3.0.3",
|
||||
"psr/event-dispatcher": ">=1.0.0",
|
||||
"symfony/event-dispatcher": ">=8.1.2",
|
||||
"symfony/event-dispatcher-contracts": ">=3.7.1",
|
||||
"symfony/deprecation-contracts": ">=3.7.1",
|
||||
"symfony/event-dispatcher": ">=8.1.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter;
|
||||
|
||||
use \League\Event\HasEventName;
|
||||
use \Symfony\Component\EventDispatcher\GenericEvent;
|
||||
|
||||
final class Event extends GenericEvent implements HasEventName
|
||||
{
|
||||
public function __construct(mixed $subject = null, array $arguments = []) {
|
||||
parent::__construct($subject, $arguments);
|
||||
}
|
||||
|
||||
public function eventName(): string
|
||||
{
|
||||
return is_string($subject = $this->getSubject()) ?
|
||||
$subject : get_class($this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user