Files
michaelschiemer/src/Framework/EventBus/EventHandler.php

25 lines
679 B
PHP

<?php
declare(strict_types=1);
namespace App\Framework\EventBus;
/**
* Attribut, das eine Methode als Event-Handler kennzeichnet.
*
* Beispiel:
* #[EventHandler]
* public function handleUserRegistered(UserRegistered $event): void { ... }
*/
#[\Attribute(\Attribute::TARGET_METHOD)]
final readonly class EventHandler
{
/**
* @param int|null $priority Priorität des Handlers (höhere Werte werden zuerst ausgeführt)
* @param bool $stopPropagation Gibt an, ob die Event-Propagation nach diesem Handler gestoppt werden soll
*/
public function __construct(
public ?int $priority = null,
public bool $stopPropagation = false
) {}
}