1 | <?php |
||
20 | trait LimitAndOffsetProvider |
||
21 | { |
||
22 | /** |
||
23 | * An alias of "limit(...)" |
||
24 | * |
||
25 | * @param int $count |
||
26 | * @return Query|$this|self |
||
27 | */ |
||
28 | 4 | public function take(int $count): self |
|
32 | |||
33 | /** |
||
34 | * @param int $count |
||
35 | * @return Query|$this|self |
||
36 | */ |
||
37 | 4 | public function limit(int $count): self |
|
41 | |||
42 | /** |
||
43 | * An alias of "offset(...)" |
||
44 | * |
||
45 | * @param int $count |
||
46 | * @return Query|$this|self |
||
47 | */ |
||
48 | 2 | public function skip(int $count): self |
|
52 | |||
53 | /** |
||
54 | * @param int $count |
||
55 | * @return Query|$this|self |
||
56 | */ |
||
57 | 2 | public function offset(int $count): self |
|
61 | |||
62 | /** |
||
63 | * @param int $from |
||
64 | * @param int $to |
||
65 | * @return Query|$this|self |
||
66 | */ |
||
67 | public function range(int $from, int $to): self |
||
75 | } |
||
76 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.