| 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 | 7 | public function __construct($id, $type) |
|
| 35 | |||
| 36 | /** |
||
| 37 | * @return int |
||
| 38 | */ |
||
| 39 | public function getId() |
||
| 43 | |||
| 44 | /** |
||
| 45 | * {@inheritdoc} |
||
| 46 | */ |
||
| 47 | public function getType() |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @return string |
||
| 54 | */ |
||
| 55 | 2 | public function getUniqId() |
|
| 59 | |||
| 60 | /** |
||
| 61 | * @return bool |
||
| 62 | */ |
||
| 63 | 4 | public function equals(TargetInterface $other) |
|
| 69 | |||
| 70 | public function jsonSerialize() |
||
| 74 | } |
||
| 75 |
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: