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 |
||
21 | final class Product extends HttpApi |
||
22 | { |
||
23 | public function variant(): Variant |
||
27 | |||
28 | /** |
||
29 | * @throws Exception |
||
30 | * |
||
31 | * @return Model|ResponseInterface |
||
32 | */ |
||
33 | View Code Duplication | public function get(string $productCode) |
|
47 | |||
48 | /** |
||
49 | * {@link https://docs.sylius.com/en/1.3/api/products.html#creating-a-product}. |
||
50 | * |
||
51 | * @throws Exception |
||
52 | * |
||
53 | * @return Model|ResponseInterface |
||
54 | */ |
||
55 | public function create(string $productCode, array $params = []) |
||
70 | |||
71 | /** |
||
72 | * Update a product partially. |
||
73 | * |
||
74 | * {@link https://docs.sylius.com/en/1.3/api/products.html#id14} |
||
75 | * |
||
76 | * @throws Exception |
||
77 | * |
||
78 | * @return void|ResponseInterface |
||
79 | */ |
||
80 | View Code Duplication | public function update(string $productCode, array $params = []) |
|
92 | |||
93 | /** |
||
94 | * @throws Exception\DomainException |
||
95 | * |
||
96 | * @return ProductCollection|ResponseInterface |
||
97 | */ |
||
98 | View Code Duplication | public function getAll(array $params = []) |
|
112 | } |
||
113 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.