implement GenericEvent

This commit is contained in:
2026-08-09 16:39:56 -04:00
parent df91dd6b57
commit 1f1a23f1a9
2 changed files with 29 additions and 1 deletions
+8 -1
View File
@@ -14,5 +14,12 @@
} }
], ],
"minimum-stability": "stable", "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"
}
} }
+21
View File
@@ -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);
}
}