| 1 | <?php |
||
| 8 | trait ManagesWorkItems |
||
| 9 | { |
||
| 10 | use TransformsWorkItems; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Get a single work item. |
||
| 14 | * |
||
| 15 | * @param string $projectId |
||
| 16 | * @param string $id |
||
| 17 | * |
||
| 18 | *@return \TestMonitor\DevOps\Resources\WorkItem |
||
| 19 | */ |
||
| 20 | 4 | public function workitem(string $id, string $projectId): WorkItem |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Create a new work item. |
||
| 29 | * |
||
| 30 | * @param \TestMonitor\DevOps\Resources\WorkItem $workItem |
||
| 31 | * @param string $projectId |
||
| 32 | * |
||
| 33 | * @return WorkItem |
||
| 34 | */ |
||
| 35 | 2 | public function createWorkItem(WorkItem $workItem, string $projectId): WorkItem |
|
| 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.