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 HeadersMatchingPolicy implements MatchingPolicy |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var \Coduo\PHPMatcher\Matcher\Matcher |
||
| 13 | */ |
||
| 14 | private $phpMatcher; |
||
| 15 | |||
| 16 | public function __construct(Matcher $phpMatcher) |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param Request $request |
||
| 23 | * @param Element $config |
||
| 24 | * @return boolean |
||
| 25 | */ |
||
| 26 | public function match(Request $request, Element $config) |
||
| 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..