| 1 | <?php |
||
| 12 | trait AutoLoaderTrait |
||
| 13 | { |
||
| 14 | |||
| 15 | // using each component loader trait |
||
| 16 | use ConfigsLoaderTrait; |
||
| 17 | use LocalizationLoaderTrait; |
||
| 18 | use MigrationsLoaderTrait; |
||
| 19 | use ViewsLoaderTrait; |
||
| 20 | use ProvidersLoaderTrait; |
||
| 21 | use ConsolesLoaderTrait; |
||
| 22 | use AliasesLoaderTrait; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * * to be used from the `boot` function of the main service provider |
||
| 26 | */ |
||
| 27 | public function runLoadersBoot() |
||
| 46 | |||
| 47 | } |
||
| 48 |
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.