| 1 | <?php |
||
| 23 | trait IndexAwareTrait |
||
| 24 | { |
||
| 25 | |||
| 26 | private $index = ''; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Get currently used index |
||
| 30 | * @return string |
||
| 31 | */ |
||
| 32 | 1 | public function getIndex() |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Set currently used index |
||
| 43 | * @param string $index |
||
| 44 | * @return static |
||
| 45 | */ |
||
| 46 | 1 | public function setIndex($index) |
|
| 55 | |||
| 56 | } |
||
| 57 |
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: