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 |
||
| 17 | class AbstractHydratorTest extends OrmFunctionalTestCase |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var EventManager|\PHPUnit_Framework_MockObject_MockObject |
||
| 21 | */ |
||
| 22 | private $mockEventManager; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var Statement|\PHPUnit_Framework_MockObject_MockObject |
||
| 26 | */ |
||
| 27 | private $mockStatement; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var ResultSetMapping|\PHPUnit_Framework_MockObject_MockObject |
||
| 31 | */ |
||
| 32 | private $mockResultMapping; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @var AbstractHydrator |
||
| 36 | */ |
||
| 37 | private $hydrator; |
||
| 38 | |||
| 39 | protected function setUp() : void |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @group DDC-3146 |
||
| 71 | * @group #1515 |
||
| 72 | * |
||
| 73 | * Verify that the number of added events to the event listener from the abstract hydrator class is equal to the |
||
| 74 | * number of removed events |
||
| 75 | */ |
||
| 76 | View Code Duplication | public function testOnClearEventListenerIsDetachedOnCleanup() : void |
|
| 92 | |||
| 93 | /** |
||
| 94 | * @group #6623 |
||
| 95 | */ |
||
| 96 | View Code Duplication | public function testHydrateAllRegistersAndClearsAllAttachedListeners() : void |
|
| 112 | } |
||
| 113 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..