1 | <?php |
||
26 | trait OuterIteratorTrait |
||
27 | { |
||
28 | /** |
||
29 | * Advances the inner iterator's pointer |
||
30 | */ |
||
31 | 2 | public function next() |
|
35 | |||
36 | /** |
||
37 | * Returns the inner iterator's current value |
||
38 | * |
||
39 | * @return mixed |
||
40 | */ |
||
41 | 2 | public function current() |
|
45 | |||
46 | /** |
||
47 | * Returns the inner iterator's current key |
||
48 | * |
||
49 | * @return scalar |
||
50 | */ |
||
51 | 2 | public function key() |
|
55 | |||
56 | /** |
||
57 | * Resets the inner iterator |
||
58 | */ |
||
59 | 2 | public function rewind() |
|
63 | |||
64 | /** |
||
65 | * Returns if the inner iterator is still valid |
||
66 | * |
||
67 | * @return boolean |
||
68 | */ |
||
69 | 2 | public function valid() |
|
73 | |||
74 | /** |
||
75 | * Returns the inner iterator |
||
76 | * |
||
77 | * @return Iterator |
||
78 | */ |
||
79 | 4 | public function getInnerIterator() : Iterator |
|
83 | } |
||
84 |
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: