1 | <?php |
||
20 | trait ExecutionsProvider |
||
21 | { |
||
22 | /** |
||
23 | * @param string ...$fields |
||
24 | * @return object[]|iterable |
||
25 | */ |
||
26 | 30 | public function get(string ...$fields): iterable |
|
42 | |||
43 | /** |
||
44 | * @param string $field |
||
45 | * @param string|null $typeOf |
||
46 | * @return mixed |
||
47 | * @throws \LogicException |
||
48 | */ |
||
49 | 10 | public function scalar(string $field, string $typeOf = null) |
|
59 | |||
60 | /** |
||
61 | * @param mixed $result |
||
62 | * @param string $typeOf |
||
63 | * @return array|\Closure|object |
||
64 | */ |
||
65 | 10 | private function cast($result, string $typeOf) |
|
91 | |||
92 | /** |
||
93 | * @param string|null $field |
||
94 | * @return int |
||
95 | * @throws \LogicException |
||
96 | */ |
||
97 | 2 | public function count(?string $field = 'id'): int |
|
102 | |||
103 | /** |
||
104 | * @param string|null $field |
||
105 | * @return int |
||
106 | * @throws \LogicException |
||
107 | */ |
||
108 | 2 | public function sum(string $field = null): int |
|
113 | |||
114 | /** |
||
115 | * @param string|null $field |
||
116 | * @return int |
||
117 | * @throws \LogicException |
||
118 | */ |
||
119 | 2 | public function avg(string $field = null): int |
|
124 | |||
125 | /** |
||
126 | * @param string|null $field |
||
127 | * @return int |
||
128 | * @throws \LogicException |
||
129 | */ |
||
130 | 2 | public function max(string $field = null): int |
|
135 | |||
136 | /** |
||
137 | * @param string|null $field |
||
138 | * @return int |
||
139 | * @throws \LogicException |
||
140 | */ |
||
141 | 2 | public function min(string $field = null): int |
|
146 | |||
147 | /** |
||
148 | * @param string ...$fields |
||
149 | * @return Collection |
||
150 | */ |
||
151 | 2 | public function collect(string ...$fields): Collection |
|
155 | |||
156 | /** |
||
157 | * @param string[] $fields |
||
158 | * @return object|null |
||
159 | * @throws \LogicException |
||
160 | */ |
||
161 | 10 | public function first(string ...$fields) |
|
165 | } |
||
166 |
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.