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 InjectionStrategyInterface |
||
| 17 | { |
||
| 18 | private $strategies; |
||
| 19 | private $cache; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param StreamInterface<InjectionStrategyInterface> $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, $value): bool |
|
| 52 | |||
| 53 | /** |
||
| 54 | * {@inheritdoc} |
||
| 55 | */ |
||
| 56 | 9 | public function inject($object, string $property, $value): void |
|
| 90 | |||
| 91 | 9 | private function generateKey($object, string $property): string |
|
| 95 | } |
||
| 96 |
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.