| 1 | <?php |
||
| 18 | abstract class AbstractTarget implements TargetInterface |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var int|string |
||
| 22 | */ |
||
| 23 | protected $id; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $type; |
||
| 29 | |||
| 30 | 9 | public function __construct($id, $type) |
|
| 35 | |||
| 36 | /** |
||
| 37 | * @return int |
||
| 38 | */ |
||
| 39 | 3 | public function getId() |
|
| 40 | { |
||
| 41 | 3 | return $this->id; |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * {@inheritdoc} |
||
| 46 | */ |
||
| 47 | 2 | public function getType() |
|
| 48 | { |
||
| 49 | 2 | return $this->type; |
|
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @return string |
||
| 54 | */ |
||
| 55 | 7 | public function getUniqueId() |
|
| 59 | |||
| 60 | /** |
||
| 61 | * @return bool |
||
| 62 | */ |
||
| 63 | 6 | public function equals(TargetInterface $other): bool |
|
| 67 | |||
| 68 | /** |
||
| 69 | * @return bool |
||
| 70 | */ |
||
| 71 | 1 | public function matches(TargetInterface $other): bool |
|
| 75 | |||
| 76 | 1 | public function checkMatches(TargetInterface $other): bool |
|
| 91 | |||
| 92 | public function jsonSerialize() |
||
| 96 | } |
||
| 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: