These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* |
||
3 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||
4 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||
5 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||
6 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||
7 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||
8 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||
9 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||
10 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||
11 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
12 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||
13 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
14 | * |
||
15 | * This software consists of voluntary contributions made by many individuals |
||
16 | * and is licensed under the MIT license. For more information, see |
||
17 | * <http://www.doctrine-project.org>. |
||
18 | */ |
||
19 | |||
20 | namespace Doctrine\ORM\Internal\Hydration; |
||
21 | |||
22 | /** |
||
23 | * Represents a result structure that can be iterated over, hydrating row-by-row |
||
24 | * during the iteration. An IterableResult is obtained by AbstractHydrator#iterate(). |
||
25 | * |
||
26 | * @author robo |
||
27 | * @since 2.0 |
||
28 | */ |
||
29 | class IterableResult implements \Iterator |
||
30 | { |
||
31 | /** |
||
32 | * @var \Doctrine\ORM\Internal\Hydration\AbstractHydrator |
||
33 | */ |
||
34 | private $_hydrator; |
||
35 | |||
36 | /** |
||
37 | * @var boolean |
||
38 | */ |
||
39 | private $_rewinded = false; |
||
40 | |||
41 | /** |
||
42 | * @var integer |
||
43 | */ |
||
44 | private $_key = -1; |
||
45 | |||
46 | /** |
||
47 | * @var object|null |
||
48 | */ |
||
49 | private $_current = null; |
||
50 | |||
51 | /** |
||
52 | * @param \Doctrine\ORM\Internal\Hydration\AbstractHydrator $hydrator |
||
53 | */ |
||
54 | 11 | public function __construct($hydrator) |
|
55 | { |
||
56 | 11 | $this->_hydrator = $hydrator; |
|
57 | 11 | } |
|
58 | |||
59 | /** |
||
60 | * @return void |
||
61 | * |
||
62 | * @throws HydrationException |
||
63 | */ |
||
64 | 5 | public function rewind() |
|
65 | { |
||
66 | 5 | if ($this->_rewinded == true) { |
|
67 | throw new HydrationException("Can only iterate a Result once."); |
||
68 | } else { |
||
69 | 5 | $this->_current = $this->next(); |
|
0 ignored issues
–
show
|
|||
70 | 5 | $this->_rewinded = true; |
|
71 | } |
||
72 | 5 | } |
|
73 | |||
74 | /** |
||
75 | * Gets the next set of results. |
||
76 | * |
||
77 | * @return array|false |
||
78 | */ |
||
79 | 10 | public function next() |
|
80 | { |
||
81 | 10 | $this->_current = $this->_hydrator->hydrateRow(); |
|
0 ignored issues
–
show
It seems like
$this->_hydrator->hydrateRow() of type false or array is incompatible with the declared type object|null of property $_current .
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..
Loading history...
|
|||
82 | 10 | $this->_key++; |
|
83 | |||
84 | 10 | return $this->_current; |
|
85 | } |
||
86 | |||
87 | /** |
||
88 | * @return mixed |
||
89 | */ |
||
90 | 5 | public function current() |
|
91 | { |
||
92 | 5 | return $this->_current; |
|
93 | } |
||
94 | |||
95 | /** |
||
96 | * @return int |
||
97 | */ |
||
98 | public function key() |
||
99 | { |
||
100 | return $this->_key; |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * @return bool |
||
105 | */ |
||
106 | 5 | public function valid() |
|
107 | { |
||
108 | 5 | return ($this->_current!=false); |
|
109 | } |
||
110 | } |
||
111 |
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..