Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
58 | 10 | protected function setUpErrorHandler() |
|
59 | { |
||
60 | 10 | $this->errors = []; |
|
61 | 10 | set_error_handler( |
|
62 | 10 | function (int $errno, string $errstr, string $errfile, int $errline, array $errcontext) { |
|
63 | 8 | $this->errors[] = [ |
|
64 | 8 | 'errno' => $errno, |
|
65 | 8 | 'errstr' => $errstr, |
|
66 | 8 | 'errfile' => $errfile, |
|
67 | 8 | 'errline' => $errline, |
|
68 | 8 | 'errcontext' => $errcontext, |
|
69 | ]; |
||
70 | 10 | }, |
|
71 | 10 | -1 |
|
72 | ); |
||
73 | 10 | } |
|
74 | } |
||
75 |
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.