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 |
||
| 11 | class PhpMatcher implements Context |
||
| 12 | { |
||
| 13 | use ApiTrait; |
||
| 14 | |||
| 15 | /** @var Factory */ |
||
| 16 | private $factory; |
||
| 17 | |||
| 18 | public function __construct(HttpHistory $history) |
||
| 24 | |||
| 25 | /** @Then the response content should match :pattern */ |
||
| 26 | View Code Duplication | public function response_content_should_match(string $pattern) |
|
| 43 | |||
| 44 | /** @Then the response content should not match :pattern */ |
||
| 45 | View Code Duplication | public function response_content_should_not_match(string $pattern) |
|
| 62 | |||
| 63 | /** @Then the response content should match: */ |
||
| 64 | View Code Duplication | public function response_content_should_match_PyString(PyStringNode $pattern) |
|
| 75 | |||
| 76 | /** @Then the response content should match: */ |
||
| 77 | View Code Duplication | public function response_content_should_not_match_PyString(PyStringNode $pattern) |
|
| 88 | } |
||
| 89 |
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..