| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4.0312 |
| Changes | 0 | ||
| 1 | <?php |
||
| 76 | 1 | public function checkMatches(TargetInterface $other): bool |
|
| 77 | { |
||
| 78 | 1 | if ($this->id === null) { |
|
| 79 | 1 | if ($this->type === null) { |
|
| 80 | 1 | return true; |
|
| 81 | } |
||
| 82 | return (string) $this->type === (string) $other->getType(); |
||
| 83 | 1 | } |
|
| 84 | |||
| 85 | if ($this->type === null) { |
||
| 86 | 1 | return (string) $this->id === (string) $other->id; |
|
|
|
|||
| 87 | } |
||
| 88 | |||
| 89 | return $this->equals($other); |
||
| 90 | 1 | } |
|
| 91 | |||
| 97 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: