| Conditions | 2 |
| Paths | 2 |
| Total Lines | 8 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 3 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | 1 | public function getScore() |
|
| 25 | { |
||
| 26 | 1 | if (!$this instanceof ScoreAwareInterface) |
|
| 27 | { |
||
| 28 | throw new UnexpectedValueException(sprintf('Class `%s` using `%s` must implement `%s`', get_class($this), __CLASS__, ScoreAwareInterface::class)); // @codeCoverageIgnore |
||
| 29 | } |
||
| 30 | 1 | return $this->score; |
|
|
|
|||
| 31 | } |
||
| 32 | |||
| 44 |
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: