1 | <?php |
||
17 | trait HasLoginsAndDevices |
||
18 | { |
||
19 | /** |
||
20 | * @param void |
||
21 | * @return HasMany |
||
22 | */ |
||
23 | public function logins() |
||
27 | |||
28 | /** |
||
29 | * @param void |
||
30 | * @return HasMany |
||
31 | */ |
||
32 | public function auths() |
||
39 | |||
40 | /** |
||
41 | * @param void |
||
42 | * @return HasMany |
||
43 | */ |
||
44 | public function fails() |
||
51 | |||
52 | /** |
||
53 | * @param void |
||
54 | * @return HasMany |
||
55 | */ |
||
56 | public function lockouts() |
||
63 | |||
64 | /** |
||
65 | * @param void |
||
66 | * @return HasMany |
||
67 | */ |
||
68 | public function devices() |
||
72 | |||
73 | /** |
||
74 | * @param void |
||
75 | * @return bool |
||
76 | */ |
||
77 | public function hasDevices() |
||
81 | } |
||
82 |
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.