| 1 | <?php |
||
| 10 | trait Iterator |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @return mixed |
||
| 14 | */ |
||
| 15 | 4 | public function current() |
|
| 19 | |||
| 20 | /** |
||
| 21 | * @return mixed |
||
| 22 | */ |
||
| 23 | 5 | public function key() |
|
| 27 | |||
| 28 | /** |
||
| 29 | * @return bool |
||
| 30 | */ |
||
| 31 | 1 | public function valid() |
|
| 35 | |||
| 36 | /** |
||
| 37 | * @return $this |
||
| 38 | */ |
||
| 39 | 2 | public function next() |
|
| 44 | |||
| 45 | /** |
||
| 46 | * @return $this |
||
| 47 | */ |
||
| 48 | 2 | public function rewind() |
|
| 53 | |||
| 54 | /** |
||
| 55 | * @return $this |
||
| 56 | */ |
||
| 57 | 1 | public function end() |
|
| 62 | } |
||
| 63 |
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: