1 | <?php |
||
7 | trait HandlesEvents |
||
8 | { |
||
9 | public function handlesEvents(): array |
||
13 | |||
14 | public function methodNameThatHandlesEvent(object $event): string |
||
28 | |||
29 | public function handleException(Exception $exception) |
||
33 | |||
34 | protected function checkNonAssociativeEvent(array $handlesEvents, string $eventClass): bool |
||
38 | |||
39 | protected function getAssociativeMethodName(array $handlesEvents, string $eventClass): string |
||
55 | |||
56 | protected function getNonAssociativeMethodName(array $handlesEvents, string $eventClass): string |
||
64 | } |
||
65 |
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: