| Total Complexity | 1 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class MagicPropertyDisabledTraitTest extends \PHPUnit\Framework\TestCase |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @test |
||
| 14 | * @covers ::__get |
||
| 15 | * @expectedException \BadMethodCallException |
||
| 16 | */ |
||
| 17 | public function magicGet() |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @test |
||
| 24 | * @covers ::__set |
||
| 25 | * @expectedException \BadMethodCallException |
||
| 26 | */ |
||
| 27 | public function magicSet() |
||
| 31 | |||
| 32 | public function getObject() |
||
| 39 | } |
||
| 40 |
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.