for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace App\Game\Features\Player;
abstract class AggregateRoot implements RaiseEventsInterface
{
/**
* @var DomainEventInterface[]
*/
protected array $events = [];
public function popEvents(): array
$events = $this->events;
$this->events = [];
return $events;
}
public function clearEvents(): void
public function raise(DomainEventInterface $event): void
$this->events[] = $event;