1 | <?php |
||
24 | trait Relationships |
||
25 | { |
||
26 | /** |
||
27 | * @param $address|null |
||
28 | * |
||
29 | * @return array|null |
||
30 | */ |
||
31 | protected function address($address = null) |
||
35 | |||
36 | /** |
||
37 | * @param Discount|null $discount |
||
38 | * |
||
39 | * @return array|null |
||
40 | */ |
||
41 | protected function discount($discount = null) |
||
45 | |||
46 | /** |
||
47 | * @param CreditPoint|null $creditPoint |
||
48 | * |
||
49 | * @return array |
||
50 | */ |
||
51 | protected function creditPoint($creditPoint = null) |
||
57 | |||
58 | /** |
||
59 | * @param PaymentMethods|null $collection |
||
60 | * |
||
61 | * @return array |
||
62 | */ |
||
63 | protected function paymentMethods($collection = null) |
||
69 | |||
70 | /** |
||
71 | * @param Items|null $items |
||
72 | * |
||
73 | * @return array |
||
74 | */ |
||
75 | protected function items($items) |
||
81 | |||
82 | /** |
||
83 | * @param Promotions|null $promotions |
||
84 | * |
||
85 | * @return array|null |
||
86 | */ |
||
87 | protected function promotions(Promotions $promotions = null) |
||
93 | } |
||
94 |
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.