| 1 | <?php |
||
| 5 | trait MediaRelation |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Make the Many To Many Morph To Relation |
||
| 9 | * @return object |
||
| 10 | */ |
||
| 11 | public function files() |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Make the Many to Many Morph to Relation with specific zone |
||
| 18 | * @param string $zone |
||
| 19 | * @return object |
||
| 20 | */ |
||
| 21 | public function filesByZone($zone) |
||
| 29 | } |
||
| 30 |
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
Idableprovides a methodequalsIdthat 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.