| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 36 | public function delegatedGet(/*# string */ $id) |
||
| 37 | { |
||
| 38 | if ($this->hasDelegator()) { |
||
| 39 | $delegator = $this->getDelegator(); |
||
| 40 | if ($delegator instanceof ChainingInterface) { |
||
| 41 | return $delegator->delegatedGet($id); |
||
| 42 | } else { |
||
| 43 | return $delegator->get($id); |
||
| 44 | } |
||
| 45 | } else { |
||
| 46 | return $this->get($id); |
||
|
|
|||
| 47 | } |
||
| 48 | } |
||
| 49 | } |
||
| 50 |
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.