| 1 | <?php |
||
| 10 | class MagicPropertyDisabledTraitTest extends \PHPUnit\Framework\TestCase |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @test |
||
| 14 | * @covers ::__get |
||
| 15 | * @expectedException \BadMethodCallException |
||
| 16 | */ |
||
| 17 | public function magicGet() |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @test |
||
| 25 | * @covers ::__set |
||
| 26 | * @expectedException \BadMethodCallException |
||
| 27 | */ |
||
| 28 | public function magicSet() |
||
| 33 | } |
||
| 34 |
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: