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 |
||
25 | abstract class AbstractRange extends AbstractFilter implements ViewDataFactoryInterface |
||
26 | { |
||
27 | /** |
||
28 | * @return bool |
||
29 | */ |
||
30 | public function isInclusive() |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | */ |
||
38 | public function createViewData() |
||
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | View Code Duplication | public function modifySearch(Search $search, FilterState $state = null, SearchRequest $request = null) |
|
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | public function isRelated() |
||
61 | } |
||
62 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: