1 | <?php |
||
20 | trait ExecutionsProvider |
||
21 | { |
||
22 | /** |
||
23 | * @param string ...$fields |
||
24 | * @return object[]|iterable |
||
25 | */ |
||
26 | 20 | public function get(string ...$fields): iterable |
|
32 | |||
33 | /** |
||
34 | * Get the values of a given key. |
||
35 | * |
||
36 | * @param string|array $value |
||
37 | * @param string|null $key |
||
38 | * @return Collection|iterable |
||
39 | */ |
||
40 | public function pluck($value, $key = null): array |
||
47 | |||
48 | /** |
||
49 | * @param string $field |
||
50 | * @param string|null $typeOf |
||
51 | * @return mixed |
||
52 | * @throws \LogicException |
||
53 | */ |
||
54 | 10 | public function scalar(string $field, string $typeOf = null) |
|
66 | |||
67 | /** |
||
68 | * @param mixed $result |
||
69 | * @param string $typeOf |
||
70 | * @return array|\Closure|object|mixed |
||
71 | */ |
||
72 | 10 | private function cast($result, string $typeOf) |
|
101 | |||
102 | /** |
||
103 | * @param string|null $field |
||
104 | * @return int |
||
105 | * @throws \LogicException |
||
106 | */ |
||
107 | 2 | public function count(string $field = null): int |
|
117 | |||
118 | /** |
||
119 | * @param string|null $field |
||
120 | * @return int |
||
121 | * @throws \LogicException |
||
122 | */ |
||
123 | 2 | public function sum(string $field = null): int |
|
129 | |||
130 | /** |
||
131 | * @param string|null $field |
||
132 | * @return int |
||
133 | * @throws \LogicException |
||
134 | */ |
||
135 | 2 | public function avg(string $field = null): int |
|
141 | |||
142 | /** |
||
143 | * @param string|null $field |
||
144 | * @return int |
||
145 | * @throws \LogicException |
||
146 | */ |
||
147 | 2 | public function max(string $field = null): int |
|
153 | |||
154 | /** |
||
155 | * @param string|null $field |
||
156 | * @return int |
||
157 | * @throws \LogicException |
||
158 | */ |
||
159 | 2 | public function min(string $field = null): int |
|
165 | |||
166 | /** |
||
167 | * @param string ...$fields |
||
168 | * @return Collection |
||
169 | */ |
||
170 | 2 | public function collect(string ...$fields): Collection |
|
174 | |||
175 | /** |
||
176 | * @param string[] $fields |
||
177 | * @return object|null |
||
178 | * @throws \LogicException |
||
179 | */ |
||
180 | public function first(string ...$fields) |
||
184 | } |
||
185 |
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.