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 |
||
| 15 | class RenameTagCommandTest extends TestCase |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var RenameTagCommand |
||
| 19 | */ |
||
| 20 | private $command; |
||
|
|
|||
| 21 | /** |
||
| 22 | * @var CommandTester |
||
| 23 | */ |
||
| 24 | private $commandTester; |
||
| 25 | /** |
||
| 26 | * @var ObjectProphecy |
||
| 27 | */ |
||
| 28 | private $tagService; |
||
| 29 | |||
| 30 | public function setUp() |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @test |
||
| 43 | */ |
||
| 44 | View Code Duplication | public function errorIsPrintedIfExceptionIsThrown() |
|
| 60 | |||
| 61 | /** |
||
| 62 | * @test |
||
| 63 | */ |
||
| 64 | View Code Duplication | public function successIsPrintedIfNoErrorOccurs() |
|
| 80 | } |
||
| 81 |
This check marks private properties in classes that are never used. Those properties can be removed.