Total Lines | 60 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
20 | interface CollectionInterface extends Countable, IteratorAggregate |
||
21 | { |
||
22 | /** |
||
23 | * @param mixed $value |
||
24 | * |
||
25 | * @return CollectionInterface |
||
26 | */ |
||
27 | public function add($value); |
||
28 | |||
29 | /** |
||
30 | * @param mixed $value |
||
31 | * |
||
32 | * @return bool |
||
33 | */ |
||
34 | public function contains($value); |
||
35 | |||
36 | /** |
||
37 | * return array. |
||
38 | */ |
||
39 | public function getAll(); |
||
40 | |||
41 | /** |
||
42 | * @param callable $fn |
||
43 | * |
||
44 | * @return CollectionInterface |
||
45 | */ |
||
46 | public function filter(callable $fn); |
||
47 | |||
48 | /** |
||
49 | * @param callable $fn |
||
50 | * |
||
51 | * @return mixed[] |
||
52 | */ |
||
53 | public function map(callable $fn); |
||
54 | |||
55 | /** |
||
56 | * @param callable $fn |
||
57 | * @param mixed $initial |
||
58 | * |
||
59 | * @return mixed |
||
60 | */ |
||
61 | public function reduce(callable $fn, $initial = null); |
||
62 | |||
63 | /** |
||
64 | * @link http://php.net/manual/en/function.usort.php |
||
65 | * |
||
66 | * @param callable $fn |
||
67 | * |
||
68 | * @return CollectionInterface |
||
69 | */ |
||
70 | public function sort(callable $fn); |
||
71 | |||
72 | /** |
||
73 | * @param callable $fn |
||
74 | * @param int $order |
||
75 | * |
||
76 | * @return CollectionInterface |
||
77 | */ |
||
78 | public function sortOn(callable $fn, $order = Sort\ASC); |
||
79 | } |
||
80 |
For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a
@return
doc comment to communicate to implementors of these methods what they are expected to return.