1 | <?php |
||
6 | abstract class MultiResultSetBase implements MultiResultSetInterface |
||
7 | { |
||
8 | /** |
||
9 | * @var null|array |
||
10 | */ |
||
11 | public $stored = null; |
||
12 | |||
13 | /** |
||
14 | * @var int |
||
15 | */ |
||
16 | public $cursor = 0; |
||
17 | |||
18 | /** |
||
19 | * @var int |
||
20 | */ |
||
21 | protected $next_cursor = 0; |
||
22 | |||
23 | /** |
||
24 | * @var \Foolz\SphinxQL\Drivers\ResultSetInterface|null |
||
25 | */ |
||
26 | protected $rowSet = null; |
||
27 | |||
28 | /** |
||
29 | * @var \Foolz\SphinxQL\Drivers\MultiResultSetAdapterInterface|null |
||
30 | */ |
||
31 | protected $adapter = null; |
||
32 | |||
33 | /** |
||
34 | * @var bool |
||
35 | */ |
||
36 | protected $valid = true; |
||
37 | |||
38 | public function getStored() |
||
43 | |||
44 | /** |
||
45 | * (PHP 5 >= 5.0.0)<br/> |
||
46 | * Whether a offset exists |
||
47 | * @link http://php.net/manual/en/arrayaccess.offsetexists.php |
||
48 | * @param mixed $offset <p> |
||
49 | * An offset to check for. |
||
50 | * </p> |
||
51 | * @return boolean true on success or false on failure. |
||
52 | * </p> |
||
53 | * <p> |
||
54 | * The return value will be casted to boolean if non-boolean was returned. |
||
55 | */ |
||
56 | public function offsetExists($offset) |
||
61 | |||
62 | /** |
||
63 | * (PHP 5 >= 5.0.0)<br/> |
||
64 | * Offset to retrieve |
||
65 | * @link http://php.net/manual/en/arrayaccess.offsetget.php |
||
66 | * @param mixed $offset <p> |
||
67 | * The offset to retrieve. |
||
68 | * </p> |
||
69 | * @return mixed Can return all value types. |
||
70 | */ |
||
71 | public function offsetGet($offset) |
||
76 | |||
77 | /** |
||
78 | * (PHP 5 >= 5.0.0)<br/> |
||
79 | * Offset to set |
||
80 | * @link http://php.net/manual/en/arrayaccess.offsetset.php |
||
81 | * @param mixed $offset <p> |
||
82 | * The offset to assign the value to. |
||
83 | * </p> |
||
84 | * @param mixed $value <p> |
||
85 | * The value to set. |
||
86 | * </p> |
||
87 | * @return void |
||
88 | * |
||
89 | * @codeCoverageIgnore |
||
90 | */ |
||
91 | public function offsetSet($offset, $value) |
||
95 | |||
96 | /** |
||
97 | * (PHP 5 >= 5.0.0)<br/> |
||
98 | * Offset to unset |
||
99 | * @link http://php.net/manual/en/arrayaccess.offsetunset.php |
||
100 | * @param mixed $offset <p> |
||
101 | * The offset to unset. |
||
102 | * </p> |
||
103 | * @return void |
||
104 | * |
||
105 | * @codeCoverageIgnore |
||
106 | */ |
||
107 | public function offsetUnset($offset) |
||
111 | |||
112 | /** |
||
113 | * (PHP 5 >= 5.0.0)<br/> |
||
114 | * Move forward to next element |
||
115 | * @link http://php.net/manual/en/iterator.next.php |
||
116 | * @return void Any returned value is ignored. |
||
117 | */ |
||
118 | public function next() |
||
122 | |||
123 | /** |
||
124 | * (PHP 5 >= 5.0.0)<br/> |
||
125 | * Return the key of the current element |
||
126 | * @link http://php.net/manual/en/iterator.key.php |
||
127 | * @return mixed scalar on success, or null on failure. |
||
128 | */ |
||
129 | public function key() |
||
133 | |||
134 | /** |
||
135 | * (PHP 5 >= 5.0.0)<br/> |
||
136 | * Rewind the Iterator to the first element |
||
137 | * @link http://php.net/manual/en/iterator.rewind.php |
||
138 | * @return void Any returned value is ignored. |
||
139 | */ |
||
140 | public function rewind() |
||
147 | |||
148 | /** |
||
149 | * (PHP 5 >= 5.1.0)<br/> |
||
150 | * Count elements of an object |
||
151 | * @link http://php.net/manual/en/countable.count.php |
||
152 | * @return int The custom count as an integer. |
||
153 | * </p> |
||
154 | * <p> |
||
155 | * The return value is cast to an integer. |
||
156 | */ |
||
157 | public function count() |
||
162 | |||
163 | /** |
||
164 | * (PHP 5 >= 5.0.0)<br/> |
||
165 | * Checks if current position is valid |
||
166 | * @link http://php.net/manual/en/iterator.valid.php |
||
167 | * @return boolean The return value will be casted to boolean and then evaluated. |
||
168 | * Returns true on success or false on failure. |
||
169 | */ |
||
170 | public function valid() |
||
178 | |||
179 | /** |
||
180 | * (PHP 5 >= 5.0.0)<br/> |
||
181 | * Return the current element |
||
182 | * @link http://php.net/manual/en/iterator.current.php |
||
183 | * @return mixed Can return any type. |
||
184 | */ |
||
185 | public function current() |
||
191 | |||
192 | /** |
||
193 | * @param null|int $cursor |
||
194 | * @return bool |
||
195 | */ |
||
196 | protected function storedValid($cursor = null) |
||
201 | |||
202 | /* |
||
203 | * @return \Foolz\SphinxQL\Drivers\ResultSetInterface|false |
||
204 | */ |
||
205 | public function getNext() |
||
223 | |||
224 | /** |
||
225 | * @return $this |
||
226 | * @throws DatabaseException |
||
227 | */ |
||
228 | public function store() |
||
253 | } |
||
254 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.