1 | <?php |
||
26 | trait UserOrganizationTrait |
||
27 | { |
||
28 | public $organizationClass = Organization::class; |
||
29 | public $memberClass = Member::class; |
||
30 | private $noInitOrganization; |
||
31 | private $noInitMember; |
||
32 | /** |
||
33 | * @return Organization |
||
34 | */ |
||
35 | protected function getNoInitOrganization() |
||
43 | /** |
||
44 | * @return Member |
||
45 | */ |
||
46 | protected function getNoInitMember() |
||
54 | |||
55 | /** |
||
56 | * |
||
57 | * @return MemberQuery |
||
58 | */ |
||
59 | public function getOfMembers() |
||
63 | |||
64 | /** |
||
65 | * |
||
66 | * @return OrganizationQuery |
||
67 | */ |
||
68 | public function getAtOrganizations() |
||
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.