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 |
||
| 12 | class AlertEndpointController extends AbstractEndpointController |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Construct |
||
| 16 | * |
||
| 17 | * @param Ps2alerts\Api\Repository\AlertRepository $repository |
||
| 18 | * @param Ps2alerts\Api\Transformer\AlertTransformer $transformer |
||
| 19 | * @param League\Fractal\Manager $fractal |
||
| 20 | */ |
||
| 21 | public function __construct( |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Returns a single alert's information |
||
| 33 | * |
||
| 34 | * @see AbstractEndpointController::respondWithItem |
||
| 35 | * |
||
| 36 | * @param Symfony\Component\HttpFoundation\Request $request |
||
| 37 | * @param Symfony\Component\HttpFoundation\Response $response |
||
| 38 | * @param array $args |
||
| 39 | * |
||
| 40 | * @return array |
||
| 41 | */ |
||
| 42 | View Code Duplication | public function getSingle(Request $request, Response $response, array $args) |
|
| 52 | |||
| 53 | View Code Duplication | public function getActives(Request $request, Response $response) |
|
| 63 | } |
||
| 64 |
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..