Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public function methodNameThatHandlesEvent(object $event): string |
||
15 | { |
||
16 | $handlesEvents = $this->handlesEvents(); |
||
17 | |||
18 | $eventClass = get_class($event); |
||
19 | |||
20 | $methodName = $this->getAssociativeMethodName($handlesEvents, $eventClass); |
||
21 | |||
22 | if ($methodName === '') { |
||
23 | $methodName = $this->getNonAssociativeMethodName($handlesEvents, $eventClass); |
||
24 | } |
||
25 | |||
26 | return $methodName; |
||
27 | } |
||
28 | |||
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: