1 | <?php |
||
10 | trait Iterator |
||
11 | { |
||
12 | /** |
||
13 | * @return mixed |
||
14 | */ |
||
15 | 4 | public function current() |
|
19 | |||
20 | /** |
||
21 | * @return mixed |
||
22 | */ |
||
23 | 3 | 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 | 1 | public function rewind() |
|
53 | |||
54 | } |
||
55 |
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: