1 | <?php |
||
18 | trait ArrayPluck |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * @param string|callable $plucker |
||
23 | * @param array $input |
||
24 | * @param int|string|array $keys |
||
25 | * @param array $expected |
||
26 | */ |
||
27 | protected function assertArrayWasCorrectlyPlucked($plucker, array $input, $keys, array $expected) |
||
40 | |||
41 | /** |
||
42 | * @param callable|string $plucker |
||
43 | * @param array $input |
||
44 | * @param int|string|array $keys |
||
45 | * @param array $expected |
||
46 | */ |
||
47 | protected function assertArrayWasCorrectlyPlucked2($plucker, array $input, $keys, array $expected) |
||
65 | } |
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.