Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php  | 
            ||
| 21 | class UserTest extends PHPUnit_Framework_TestCase  | 
            ||
| 22 | { | 
            ||
| 23 | use ValueObjectTestTrait;  | 
            ||
| 24 | |||
| 25 | /**  | 
            ||
| 26 | * Test a new class and default values on properties.  | 
            ||
| 27 | *  | 
            ||
| 28 | * @covers \eZ\Publish\Core\Repository\Values\User\User::__construct  | 
            ||
| 29 | */  | 
            ||
| 30 | public function testNewClass()  | 
            ||
| 46 | |||
| 47 | /**  | 
            ||
| 48 | * Test getName method.  | 
            ||
| 49 | *  | 
            ||
| 50 | * @covers \eZ\Publish\Core\Repository\Values\User\User::getName  | 
            ||
| 51 | */  | 
            ||
| 52 | View Code Duplication | public function testGetName()  | 
            |
| 53 |     { | 
            ||
| 54 | $name = 'Translated name';  | 
            ||
| 55 | $contentMock = Mockery::mock(Content::class);  | 
            ||
| 56 | $versionInfoMock = Mockery::mock(VersionInfo::class);  | 
            ||
| 57 | |||
| 58 |         $contentMock->shouldReceive('getVersionInfo')->andReturn($versionInfoMock); | 
            ||
| 59 |         $versionInfoMock->shouldReceive('getName')->andReturn($name); | 
            ||
| 60 | |||
| 61 | $object = new User(['content' => $contentMock]);  | 
            ||
| 62 | |||
| 63 | $this->assertEquals($name, $object->getName());  | 
            ||
| 64 | }  | 
            ||
| 65 | |||
| 66 | /**  | 
            ||
| 67 | * Test retrieving missing property.  | 
            ||
| 68 | *  | 
            ||
| 69 | * @covers \eZ\Publish\API\Repository\Values\User\User::__get  | 
            ||
| 70 | * @expectedException \eZ\Publish\API\Repository\Exceptions\PropertyNotFoundException  | 
            ||
| 71 | */  | 
            ||
| 72 | public function testMissingProperty()  | 
            ||
| 78 | |||
| 79 | /**  | 
            ||
| 80 | * Test setting read only property.  | 
            ||
| 81 | *  | 
            ||
| 82 | * @covers \eZ\Publish\API\Repository\Values\User\User::__set  | 
            ||
| 83 | * @expectedException \eZ\Publish\API\Repository\Exceptions\PropertyReadOnlyException  | 
            ||
| 84 | */  | 
            ||
| 85 | public function testReadOnlyProperty()  | 
            ||
| 91 | |||
| 92 | /**  | 
            ||
| 93 | * Test if property exists.  | 
            ||
| 94 | *  | 
            ||
| 95 | * @covers \eZ\Publish\API\Repository\Values\User\User::__isset  | 
            ||
| 96 | */  | 
            ||
| 97 | public function testIsPropertySet()  | 
            ||
| 106 | |||
| 107 | /**  | 
            ||
| 108 | * Test unsetting a property.  | 
            ||
| 109 | *  | 
            ||
| 110 | * @covers \eZ\Publish\API\Repository\Values\User\User::__unset  | 
            ||
| 111 | * @expectedException \eZ\Publish\API\Repository\Exceptions\PropertyReadOnlyException  | 
            ||
| 112 | */  | 
            ||
| 113 | public function testUnsetProperty()  | 
            ||
| 119 | }  | 
            ||
| 120 | 
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.