| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace BuildR\Collection\Collection; |
||
| 55 | protected function doTypeCheck($value) { |
||
| 56 | if($this->isStrict()) { |
||
| 57 | $result = (bool) $this->typeChecker($value); |
||
|
|
|||
| 58 | |||
| 59 | if($result === FALSE) { |
||
| 60 | $message = ($this->typeCheckFailMessage === NULL) ? gettype($value) : $this->typeCheckFailMessage; |
||
| 61 | |||
| 62 | throw CollectionException::typeException($message); |
||
| 63 | } |
||
| 64 | |||
| 65 | return TRUE; |
||
| 66 | } |
||
| 67 | } |
||
| 68 | |||
| 70 |
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.