1 | <?php |
||
4 | trait CollectionSorterTrait |
||
5 | { |
||
6 | /** |
||
7 | * Reindex the keys |
||
8 | * |
||
9 | * @return $this |
||
|
|||
10 | */ |
||
11 | 1 | public function reindex() |
|
15 | |||
16 | /** |
||
17 | * @param callable $callback |
||
18 | * @return $this |
||
19 | * @deprecated |
||
20 | */ |
||
21 | public function sort(callable $callback) |
||
27 | |||
28 | /** |
||
29 | * Reverses the values |
||
30 | * |
||
31 | * @param bool $areKeysPreserved |
||
32 | * @return $this |
||
33 | */ |
||
34 | 1 | public function reverse($areKeysPreserved = true) |
|
38 | |||
39 | /** |
||
40 | * Shuffles the values |
||
41 | * |
||
42 | * @param bool $areKeysPreserved |
||
43 | * @return $this |
||
44 | */ |
||
45 | 2 | public function shuffle($areKeysPreserved = true) |
|
57 | |||
58 | /** |
||
59 | * Splits the values into every possible response returned by the callback. |
||
60 | * |
||
61 | * For example, if the callback juste return the value: |
||
62 | * ['a', 'b', 'c'] |
||
63 | * will become: |
||
64 | * ['a' => ['a'], 'b' => ['b'], 'c' => ['c']] |
||
65 | * |
||
66 | * If the callback return a boolean, it will be return an array with two collections. |
||
67 | * [0 => $nonMatchedCollection, 1 => $matchedCollection] |
||
68 | * This seems to be quite the same as Doctrine's ARrayCollection. But be careful because keys are inverted. |
||
69 | * |
||
70 | * @param callable $callback |
||
71 | * @return $this[] |
||
72 | */ |
||
73 | 1 | public function groupBy(callable $callback) |
|
85 | } |
||
86 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.