| 1 | <?php |
||
| 19 | trait IndexAwareTrait |
||
| 20 | { |
||
| 21 | |||
| 22 | private $index = ''; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Get currently used index |
||
| 26 | * @return string |
||
| 27 | */ |
||
| 28 | 1 | public function getIndex() |
|
| 36 | |||
| 37 | /** |
||
| 38 | * Set currently used index |
||
| 39 | * @param string $index |
||
| 40 | * @return static |
||
| 41 | */ |
||
| 42 | 1 | public function setIndex($index) |
|
| 51 | |||
| 52 | } |
||
| 53 |
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: