Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
51 | 9 | protected function setUpErrorHandler() |
|
52 | { |
||
53 | 9 | $this->errors = []; |
|
54 | 9 | set_error_handler( |
|
55 | 9 | function (int $errno, string $errstr, string $errfile, int $errline, array $errcontext) { |
|
56 | 7 | $this->errors[] = [ |
|
57 | 7 | 'errno' => $errno, |
|
58 | 7 | 'errstr' => $errstr, |
|
59 | 7 | 'errfile' => $errfile, |
|
60 | 7 | 'errline' => $errline, |
|
61 | 7 | 'errcontext' => $errcontext, |
|
62 | ]; |
||
63 | 9 | }, |
|
64 | 9 | -1 |
|
65 | ); |
||
66 | 9 | } |
|
67 | } |
||
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
Idable
provides a methodequalsId
that 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.