| Conditions | 4 |
| Paths | 4 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 108 | public function __invoke($subject, string $field): bool |
|
| 36 | { |
||
| 37 | 108 | $value = $subject->$field; |
|
| 38 | |||
| 39 | 108 | if ($this->isTrue($value)) { |
|
| 40 | 54 | $subject->$field = $this->trueValue; |
|
| 41 | |||
| 42 | 54 | return true; |
|
| 43 | } |
||
| 44 | |||
| 45 | 54 | if ($this->isFalse($value)) { |
|
| 46 | 48 | $subject->$field = $this->falseValue; |
|
| 47 | |||
| 48 | 48 | return true; |
|
| 49 | } |
||
| 50 | |||
| 51 | 6 | $subject->$field = $value ? $this->trueValue : $this->falseValue; |
|
| 52 | |||
| 53 | 6 | return true; |
|
| 54 | } |
||
| 55 | } |
||
| 56 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.