| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 18 | 17 | public function __construct($value, $default = null) |
|
| 19 | { |
||
| 20 | 17 | if ($value === null) { |
|
| 21 | 1 | $value = $default; |
|
| 22 | 1 | } |
|
| 23 | |||
| 24 | 17 | that($value)->nullOr()->scalar(); |
|
| 25 | |||
| 26 | $options = [ |
||
| 27 | 15 | 'flags' => \FILTER_NULL_ON_FAILURE, |
|
| 28 | 15 | ]; |
|
| 29 | |||
| 30 | 15 | $value = filter_var($value, \FILTER_VALIDATE_BOOLEAN, $options); |
|
| 31 | |||
| 32 | 15 | that($value)->boolean(); |
|
| 33 | |||
| 34 | 12 | $this->value = $value; |
|
| 35 | 12 | } |
|
| 36 | |||
| 45 |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.