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 namespace Anomaly\Streams\Platform\Ui\Table\Component\View\Command; |
||
| 15 | class SetActiveView |
||
| 16 | { |
||
| 17 | |||
| 18 | /** |
||
| 19 | * The table builder. |
||
| 20 | * |
||
| 21 | * @var TableBuilder |
||
| 22 | */ |
||
| 23 | protected $builder; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Create a new BuildTableFiltersCommand instance. |
||
| 27 | * |
||
| 28 | * @param TableBuilder $builder |
||
| 29 | */ |
||
| 30 | public function __construct(TableBuilder $builder) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Handle the command. |
||
| 37 | * |
||
| 38 | * @param Request $request |
||
| 39 | * @param Container $container |
||
|
|
|||
| 40 | */ |
||
| 41 | public function handle(Request $request, ViewHandler $handler) |
||
| 91 | } |
||
| 92 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.