2929use Cake \Collection \CollectionTrait ;
3030use Cake \Core \InstanceConfigTrait ;
3131use Cake \Datasource \ResultSetInterface ;
32- use Cake \ORM \Query ;
32+ use Cake \ORM \Query \SelectQuery ;
33+ use ReturnTypeWillChange ;
3334use RuntimeException ;
3435
3536class ResultSet implements ResultSetInterface
@@ -42,70 +43,70 @@ class ResultSet implements ResultSetInterface
4243 *
4344 * @var mixed
4445 */
45- protected $ current ;
46+ protected mixed $ current ;
4647
4748 /**
4849 * Query instance.
4950 *
50- * @var \Cake\ORM\Query
51+ * @var \Cake\ORM\Query\SelectQuery
5152 */
52- protected $ query ;
53+ protected SelectQuery $ query ;
5354
5455 /**
5556 * Current chunk size.
5657 *
5758 * @var int
5859 */
59- protected $ chunkSize = 0 ;
60+ protected int $ chunkSize = 0 ;
6061
6162 /**
6263 * Current chunk index.
6364 *
6465 * @var int
6566 */
66- protected $ chunkIndex = 0 ;
67+ protected int $ chunkIndex = 0 ;
6768
6869 /**
6970 * Current chunk content.
7071 *
71- * @var array
72+ * @var array<int, mixed>
7273 */
73- protected $ chunk ;
74+ protected array $ chunk ;
7475
7576 /**
7677 * Current element index.
7778 *
7879 * @var int
7980 */
80- protected $ index = 0 ;
81+ protected int $ index = 0 ;
8182
8283 /**
8384 * Current page.
8485 *
8586 * @var int
8687 */
87- protected $ page = 0 ;
88+ protected int $ page = 0 ;
8889
8990 /**
9091 * Original query offset.
9192 *
92- * @var int
93+ * @var ? int
9394 */
94- protected $ offset ;
95+ protected ? int $ offset ;
9596
9697 /**
9798 * Original query limit.
9899 *
99- * @var int
100+ * @var ? int
100101 */
101- protected $ limit ;
102+ protected ? int $ limit ;
102103
103104 /**
104105 * Total count.
105106 *
106107 * @var int
107108 */
108- protected $ count ;
109+ protected int $ count ;
109110
110111 /**
111112 * Default config.
@@ -114,18 +115,18 @@ class ResultSet implements ResultSetInterface
114115 *
115116 * @var array
116117 */
117- protected $ _defaultConfig = [
118+ protected array $ _defaultConfig = [
118119 'size ' => 1000 ,
119120 ];
120121
121122 /**
122123 * Constructor.
123124 *
124- * @param \Cake\ORM\Query $query Query object.
125+ * @param \Cake\ORM\Query\SelectQuery $query Query object.
125126 * @param array $config Configuration.
126127 * @throws \RuntimeException When query is not supported.
127128 */
128- public function __construct (Query $ query , array $ config = [])
129+ public function __construct (SelectQuery $ query , array $ config = [])
129130 {
130131 $ type = $ query ->type ();
131132 if ($ type !== 'select ' ) {
@@ -144,17 +145,17 @@ public function __construct(Query $query, array $config = [])
144145 /**
145146 * @inheritDoc
146147 */
147- #[\ ReturnTypeWillChange]
148- public function current ()
148+ #[ReturnTypeWillChange]
149+ public function current (): mixed
149150 {
150151 return $ this ->current ;
151152 }
152153
153154 /**
154155 * @inheritDoc
155156 */
156- #[\ ReturnTypeWillChange]
157- public function key ()
157+ #[ReturnTypeWillChange]
158+ public function key (): mixed
158159 {
159160 return $ this ->index ;
160161 }
@@ -215,7 +216,7 @@ public function valid(): bool
215216 *
216217 * @return void
217218 */
218- protected function fetchChunk ()
219+ protected function fetchChunk (): void
219220 {
220221 $ size = $ this ->getConfig ('size ' );
221222
@@ -251,12 +252,12 @@ public function count(): int
251252 *
252253 * Serialization is not supported (yet). *
253254 */
254- public function serialize ()
255+ public function serialize (): never
255256 {
256257 throw new RuntimeException ('You cannot serialize this result set. ' );
257258 }
258259
259- public function __serialize (): array
260+ public function __serialize (): never
260261 {
261262 throw new RuntimeException ('You cannot serialize this result set. ' );
262263 }
@@ -266,12 +267,12 @@ public function __serialize(): array
266267 *
267268 * Serialization is not supported (yet). *
268269 */
269- public function unserialize ($ serialized )
270+ public function unserialize (string $ serialized ): never
270271 {
271272 throw new RuntimeException ('You cannot unserialize this result set. ' );
272273 }
273274
274- public function __unserialize (array $ data ): void
275+ public function __unserialize (array $ data ): never
275276 {
276277 throw new RuntimeException ('You cannot unserialize this result set. ' );
277278 }
0 commit comments