| 1 | <?php | ||
| 14 | class Dispatcher implements DomainEventDispatcher | ||
| 15 | { | ||
| 16 | /** | ||
| 17 | * @var EventDispatcherInterface | ||
| 18 | */ | ||
| 19 | private $dispatcher; | ||
| 20 | |||
| 21 | /** | ||
| 22 | * @param EventDispatcherInterface $dispatcher | ||
| 23 | */ | ||
| 24 | 3 | public function __construct(EventDispatcherInterface $dispatcher) | |
| 28 | |||
| 29 | /** | ||
| 30 |      * {@inheritdoc} | ||
| 31 | */ | ||
| 32 | 1 | public function dispatch(DomainEvent $event) | |
| 39 | |||
| 40 | 1 | private function resolveEventName(DomainEvent $event) | |
| 47 | } | 
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: