1 | <?php |
||
7 | trait MicrotimeTrait |
||
8 | { |
||
9 | 23 | public function setWhenAt(\DateTime $whenAt) |
|
15 | |||
16 | /** |
||
17 | * @return \DateTime|null |
||
18 | */ |
||
19 | 40 | public function getWhenAt() |
|
28 | |||
29 | /** |
||
30 | * @param string |
||
31 | */ |
||
32 | 25 | public function setWhenUs($whenUs) |
|
38 | |||
39 | /** |
||
40 | * @param string |
||
41 | */ |
||
42 | 36 | public function getWhenUs() |
|
46 | } |
||
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: