@@ -61,23 +61,24 @@ class ResponseCollection implements ArrayAccess, SeekableIterator, Countable
61
61
{
62
62
63
63
/**
64
- * @var array An array with all {@link Response} objects.
64
+ * @var Response[] An array with all {@link Response} objects.
65
65
*/
66
66
protected $ responses = array ();
67
67
68
68
/**
69
- * @var array An array with each {@link Response} object's type.
69
+ * @var string[] An array with each {@link Response} object's type.
70
70
*/
71
71
protected $ responseTypes = array ();
72
72
73
73
/**
74
- * @var array An array with each {@link Response} object's tag.
74
+ * @var string[] An array with each {@link Response} object's tag.
75
75
*/
76
76
protected $ responseTags = array ();
77
77
78
78
/**
79
- * @var array An array with positions of responses, based on an property
80
- * name. The name of each property is the array key, and the array value
79
+ * @var array<string,array<string,int>> An array with
80
+ * positions of responses, based on an property name.
81
+ * The name of each property is the array key, and the array value
81
82
* is another array where the key is the value for that property, and
82
83
* the value is the position of the response. For performance reasons,
83
84
* each key is built only when {@link static::setIndex()} is called with
@@ -87,7 +88,7 @@ class ResponseCollection implements ArrayAccess, SeekableIterator, Countable
87
88
protected $ responsesIndex = array ();
88
89
89
90
/**
90
- * @var array An array with all distinct properties across all
91
+ * @var array<string,int[]> An array with all distinct properties across all
91
92
* {@link Response} objects. Created at the first call of
92
93
* {@link static::getPropertyMap()}.
93
94
*/
@@ -104,16 +105,17 @@ class ResponseCollection implements ArrayAccess, SeekableIterator, Countable
104
105
protected $ index = null ;
105
106
106
107
/**
107
- * @var array Criteria used by {@link compare()} to determine the order
108
- * between two responses. See {@link orderBy()} for a detailed
109
- * description of this array's format.
108
+ * @var string[]|array<string,null|int|array<int|callable>> Criteria
109
+ * used by {@link static::compare()} to determine
110
+ * the order between two responses. See {@link static::orderBy()}
111
+ * for a detailed description of this array's format.
110
112
*/
111
113
protected $ compareBy = array ();
112
114
113
115
/**
114
116
* Creates a new collection.
115
117
*
116
- * @param array $responses An array of responses, in network order.
118
+ * @param Response[] $responses An array of responses, in network order.
117
119
*/
118
120
public function __construct (array $ responses )
119
121
{
@@ -198,7 +200,7 @@ public function getIndex()
198
200
* @param bool $useIndex Whether to use the index values as keys for the
199
201
* resulting array.
200
202
*
201
- * @return array An array with all responses, in network order.
203
+ * @return Response[] An array with all responses, in network order.
202
204
*/
203
205
public function toArray ($ useIndex = false )
204
206
{
@@ -305,9 +307,9 @@ public function offsetUnset($offset)
305
307
306
308
/**
307
309
* Resets the pointer to 0, and returns the first response.
308
- *
309
- * @return Response The first response in the collection, or FALSE if the
310
- * collection is empty.
310
+ *
311
+ * @return Response|false The first response in the collection,
312
+ * or FALSE if the collection is empty.
311
313
*/
312
314
public function rewind ()
313
315
{
@@ -320,9 +322,9 @@ public function rewind()
320
322
* @param int|string $position The position to move to. If the collection is
321
323
* indexed, you can also supply a value to move the pointer to.
322
324
* A non-existent index will move the pointer to "-1".
323
- *
324
- * @return Response The {@link Response} at the specified position, or FALSE
325
- * if the specified position is not valid.
325
+ *
326
+ * @return Response|false The {@link Response} at the specified position,
327
+ * or FALSE if the specified position is not valid.
326
328
*/
327
329
public function seek ($ position )
328
330
{
@@ -338,9 +340,9 @@ public function seek($position)
338
340
339
341
/**
340
342
* Moves the pointer forward by 1, and gets the next response.
341
- *
342
- * @return Response The next {@link Response} object, or FALSE if the
343
- * position is not valid.
343
+ *
344
+ * @return Response|false The next {@link Response} object,
345
+ * or FALSE if the position is not valid.
344
346
*/
345
347
public function next ()
346
348
{
@@ -350,9 +352,9 @@ public function next()
350
352
351
353
/**
352
354
* Gets the response at the current pointer position.
353
- *
354
- * @return Response The response at the current pointer position, or FALSE
355
- * if the position is not valid.
355
+ *
356
+ * @return Response|false The response at the current pointer position,
357
+ * or FALSE if the position is not valid.
356
358
*/
357
359
public function current ()
358
360
{
@@ -361,9 +363,9 @@ public function current()
361
363
362
364
/**
363
365
* Moves the pointer backwards by 1, and gets the previous response.
364
- *
365
- * @return Response The next {@link Response} object, or FALSE if the
366
- * position is not valid.
366
+ *
367
+ * @return Response|false The next {@link Response} object,
368
+ * or FALSE if the position is not valid.
367
369
*/
368
370
public function prev ()
369
371
{
@@ -374,9 +376,9 @@ public function prev()
374
376
/**
375
377
* Moves the pointer to the last valid position, and returns the last
376
378
* response.
377
- *
378
- * @return Response The last response in the collection, or FALSE if the
379
- * collection is empty.
379
+ *
380
+ * @return Response|false The last response in the collection,
381
+ * or FALSE if the collection is empty.
380
382
*/
381
383
public function end ()
382
384
{
@@ -386,9 +388,10 @@ public function end()
386
388
387
389
/**
388
390
* Gets the key at the current pointer position.
389
- *
390
- * @return int The key at the current pointer position, i.e. the pointer
391
- * position itself, or FALSE if the position is not valid.
391
+ *
392
+ * @return int|false The key at the current pointer position,
393
+ * i.e. the pointer position itself, or FALSE if the position
394
+ * is not valid.
392
395
*/
393
396
public function key ()
394
397
{
@@ -410,8 +413,9 @@ public function valid()
410
413
*
411
414
* Gets all distinct property names across all responses.
412
415
*
413
- * @return array An array with all distinct property names as keys, and the
414
- * indexes at which they occur as values.
416
+ * @return array<string,int[]> An array with
417
+ * all distinct property names as keys, and
418
+ * the indexes at which they occur as values.
415
419
*/
416
420
public function getPropertyMap ()
417
421
{
@@ -469,7 +473,8 @@ public function getAllTagged($tag)
469
473
/**
470
474
* Order resones by criteria.
471
475
*
472
- * @param mixed[] $criteria The criteria to order responses by. It takes the
476
+ * @param string[]|array<string,null|int|array<int|callable>> $criteria The
477
+ * criteria to order responses by. It takes the
473
478
* form of an array where each key is the name of the property to use
474
479
* as (N+1)th sorting key. The value of each member can be either NULL
475
480
* (for that property, sort normally in ascending order), a single sort
0 commit comments