1 | <?php |
||
11 | trait CommonMutableContainerTrait |
||
12 | { |
||
13 | /** |
||
14 | * {@inheritdoc} |
||
15 | 1 | */ |
|
16 | public function addAll($items) |
||
33 | |||
34 | 2 | /** |
|
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | 3 | public function values() |
|
41 | 1 | ||
42 | 1 | public function keys() |
|
46 | |||
47 | /** |
||
48 | * {@inheritDoc} |
||
49 | */ |
||
50 | 17 | public function concat($iterable) |
|
58 | 1 | ||
59 | 17 | /** |
|
60 | * {@inheritdoc} |
||
61 | 17 | */ |
|
62 | public function clear() |
||
72 | } |
||
73 |
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.