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 |
||
| 16 | final class DelegationStrategy implements ExtractionStrategyInterface |
||
| 17 | { |
||
| 18 | private $strategies; |
||
| 19 | private $cache; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param StreamInterface<ExtractionStrategyInterface> $strategies |
||
|
|
|||
| 23 | */ |
||
| 24 | 7 | View Code Duplication | public function __construct(StreamInterface $strategies) |
| 33 | |||
| 34 | /** |
||
| 35 | * {@inheritdoc} |
||
| 36 | */ |
||
| 37 | 1 | public function supports($object, string $property): bool |
|
| 52 | |||
| 53 | /** |
||
| 54 | * {@inheritdoc} |
||
| 55 | */ |
||
| 56 | 6 | public function extract($object, string $property) |
|
| 88 | |||
| 89 | 6 | private function generateKey($object, string $property): string |
|
| 93 | } |
||
| 94 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.