Total Complexity | 10 |
Total Lines | 74 |
Duplicated Lines | 0 % |
Coverage | 85.71% |
Changes | 0 |
1 | <?php |
||
16 | class IterableResult implements Iterator |
||
17 | { |
||
18 | /** @var AbstractHydrator */ |
||
19 | private $hydrator; |
||
20 | |||
21 | /** @var bool */ |
||
22 | private $rewinded = false; |
||
23 | |||
24 | /** @var int */ |
||
25 | private $key = -1; |
||
26 | |||
27 | /** @var object|null */ |
||
28 | private $current; |
||
29 | |||
30 | /** |
||
31 | * @param AbstractHydrator $hydrator |
||
32 | */ |
||
33 | 11 | public function __construct($hydrator) |
|
34 | { |
||
35 | 11 | $this->hydrator = $hydrator; |
|
36 | 11 | } |
|
37 | |||
38 | /** |
||
39 | * @throws HydrationException |
||
40 | */ |
||
41 | 5 | public function rewind() |
|
42 | { |
||
43 | 5 | if ($this->rewinded === true) { |
|
44 | throw new HydrationException('Can only iterate a Result once.'); |
||
45 | } |
||
46 | |||
47 | 5 | $this->current = $this->next(); |
|
|
|||
48 | 5 | $this->rewinded = true; |
|
49 | 5 | } |
|
50 | |||
51 | /** |
||
52 | * Gets the next set of results. |
||
53 | * |
||
54 | * @return mixed|false |
||
55 | */ |
||
56 | 10 | public function next() |
|
66 | } |
||
67 | |||
68 | /** |
||
69 | * @return mixed |
||
70 | */ |
||
71 | 5 | public function current() |
|
72 | { |
||
73 | 5 | return $this->current; |
|
74 | } |
||
75 | |||
76 | /** |
||
77 | * @return int |
||
78 | */ |
||
79 | public function key() |
||
80 | { |
||
81 | return $this->key; |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * @return bool |
||
86 | */ |
||
87 | 5 | public function valid() |
|
90 | } |
||
91 | } |
||
92 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..