| 1 | <?php |
||
| 32 | trait loadTasks |
||
| 33 | { |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Returns the extended watch task. |
||
| 37 | * |
||
| 38 | * @return AppserverIo\RoboTasks\Base\Watch |
||
| 39 | */ |
||
| 40 | protected function taskWatch() |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Returns the extended sync task. |
||
| 47 | * |
||
| 48 | * @return AppserverIo\RoboTasks\Base\Sync |
||
| 49 | */ |
||
| 50 | protected function taskSync() |
||
| 54 | } |
||
| 55 |
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.