1 | <?php |
||
29 | trait CollectionIterator |
||
30 | { |
||
31 | private $iteratorPosition = 0; |
||
32 | |||
33 | public function current() |
||
37 | |||
38 | public function rewind() |
||
42 | |||
43 | public function key() |
||
47 | |||
48 | public function next() |
||
52 | |||
53 | public function valid() |
||
54 | { |
||
55 | $v = (bool) ($this->getItem($this->iteratorPosition) != null); |
||
56 | return $v; |
||
57 | } |
||
58 | |||
59 | protected abstract function getItem($index); |
||
60 | } |
||
61 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.