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 |
||
| 9 | class DummyQueuedJob extends AbstractQueuedJob |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @param int $number |
||
| 13 | */ |
||
| 14 | public function __construct($number = 0) |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @return string |
||
| 24 | */ |
||
| 25 | public function getTitle() |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @return string |
||
| 32 | */ |
||
| 33 | public function getJobType() |
||
| 37 | |||
| 38 | public function setup() |
||
| 44 | |||
| 45 | View Code Duplication | public function process() |
|
| 68 | } |
||
| 69 |
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.