69
69
* @author Qiang Xue <[email protected] >
70
70
* @author Carsten Brandt <[email protected] >
71
71
* @since 2.0
72
+ *
73
+ * @template T of (ActiveRecord|array)
72
74
*/
73
75
class ActiveQuery extends Query implements ActiveQueryInterface
74
76
{
@@ -127,6 +129,8 @@ public function init()
127
129
* @param Connection|null $db the DB connection used to create the DB command.
128
130
* If null, the DB connection returned by [[modelClass]] will be used.
129
131
* @return array|ActiveRecord[] the query results. If the query results in nothing, an empty array will be returned.
132
+ * @psalm-return T[]
133
+ * @phpstan-return T[]
130
134
*/
131
135
public function all ($ db = null )
132
136
{
@@ -295,9 +299,11 @@ private function removeDuplicatedModels($models)
295
299
* Executes query and returns a single row of result.
296
300
* @param Connection|null $db the DB connection used to create the DB command.
297
301
* If `null`, the DB connection returned by [[modelClass]] will be used.
298
- * @return ActiveRecord| array|null a single row of query result. Depending on the setting of [[asArray]],
302
+ * @return array|ActiveRecord |null a single row of query result. Depending on the setting of [[asArray]],
299
303
* the query result may be either an array or an ActiveRecord object. `null` will be returned
300
304
* if the query results in nothing.
305
+ * @psalm-return T|null
306
+ * @phpstan-return T|null
301
307
*/
302
308
public function one ($ db = null )
303
309
{
@@ -310,6 +316,32 @@ public function one($db = null)
310
316
return null ;
311
317
}
312
318
319
+ /**
320
+ * {@inheritdoc}
321
+ *
322
+ * @return BatchQueryResult
323
+ * @psalm-return T[][]|BatchQueryResult
324
+ * @phpstan-return T[][]|BatchQueryResult
325
+ * @codeCoverageIgnore
326
+ */
327
+ public function batch ($ batchSize = 100 , $ db = null )
328
+ {
329
+ return parent ::batch ($ batchSize , $ db );
330
+ }
331
+
332
+ /**
333
+ * {@inheritdoc}
334
+ *
335
+ * @return BatchQueryResult
336
+ * @psalm-return T[]|BatchQueryResult
337
+ * @phpstan-return T[]|BatchQueryResult
338
+ * @codeCoverageIgnore
339
+ */
340
+ public function each ($ batchSize = 100 , $ db = null )
341
+ {
342
+ return parent ::each ($ batchSize , $ db );
343
+ }
344
+
313
345
/**
314
346
* Creates a DB command that can be used to execute this query.
315
347
* @param Connection|null $db the DB connection used to create the DB command.
0 commit comments