| 1 | <?php |
||
| 11 | trait MailServiceAwareTrait |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var MailServiceInterface |
||
| 15 | */ |
||
| 16 | protected $mailService; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param MailServiceInterface $mailService |
||
| 20 | * @return $this |
||
| 21 | */ |
||
| 22 | public function setMailService(MailServiceInterface $mailService) |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @return MailServiceInterface |
||
| 31 | */ |
||
| 32 | public function getMailService() |
||
| 44 | } |
||
| 45 |
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: