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 |
||
| 7 | class MysqlIntroductionRepository implements IntroductionRepositoryInterface |
||
| 8 | { |
||
| 9 | |||
| 10 | /** @var Aura\Sql\ConnectionLocator */ |
||
| 11 | protected $connections; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @param Aura\Sql\ConnectionLocator |
||
| 15 | */ |
||
| 16 | public function __construct(ConnectionLocator $connections) |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param string $type |
||
| 23 | * @param string $value |
||
| 24 | * |
||
| 25 | * @return array|false |
||
| 26 | */ |
||
| 27 | View Code Duplication | public function findByType($type, $value = '') |
|
| 44 | } |
||
| 45 |
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..