| 1 | <?php |
||
| 7 | class NavbarRightControl extends BaseControl |
||
| 8 | { |
||
| 9 | |||
| 10 | const TEMPLATE_NAME = 'NavbarRight'; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var User |
||
| 14 | */ |
||
| 15 | private $user; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param User $user |
||
| 19 | */ |
||
| 20 | public function __construct(User $user) |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @return void |
||
| 27 | */ |
||
| 28 | public function render($backlink) |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @return User |
||
| 40 | */ |
||
| 41 | protected function getUser(): User |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @param User $user |
||
| 48 | * @return $this |
||
| 49 | */ |
||
| 50 | protected function setUser(User $user): self |
||
| 56 | |||
| 57 | } |
||
| 58 |
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: