| Conditions | 4 |
| Paths | 3 |
| Total Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4.0466 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | 8 | public function assertError(string $errstr, int $errno) |
|
| 27 | { |
||
| 28 | 8 | foreach ($this->errors as $error) { |
|
| 29 | 7 | if ($error['errstr'] === $errstr && $error['errno'] === $errno) { |
|
| 30 | 7 | $this->assertTrue(true); |
|
|
|
|||
| 31 | |||
| 32 | 7 | return; |
|
| 33 | } |
||
| 34 | } |
||
| 35 | 1 | $this->fail("Error with level {$errno} and message '{$errstr}' not found in ".var_export($this->errors, true)); |
|
| 36 | } |
||
| 37 | |||
| 68 |
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.