Conditions | 2 |
Paths | 1 |
Total Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
38 | protected function getEventHandlingMethods(): Collection |
||
39 | { |
||
40 | return collect($this->handlesEvents ?? []) |
||
|
|||
41 | ->mapWithKeys(function (string $handlerMethod, $eventClass) { |
||
42 | if (is_numeric($eventClass)) { |
||
43 | return [$handlerMethod => 'on'.ucfirst(class_basename($handlerMethod))]; |
||
44 | } |
||
45 | |||
46 | return [$eventClass => $handlerMethod]; |
||
47 | }); |
||
48 | } |
||
49 | } |
||
50 |
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: