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 |
||
3 | class FormBlockTest extends SapphireTest |
||
4 | { |
||
5 | /** |
||
6 | * @var string |
||
7 | */ |
||
8 | protected static $fixture_file = 'dynamic-blocks/tests/Fixtures.yml'; |
||
9 | |||
10 | /** |
||
11 | * |
||
12 | */ |
||
13 | public function testGetPluralName() |
||
18 | |||
19 | /** |
||
20 | * |
||
21 | */ |
||
22 | public function testGetCMSFields() |
||
28 | |||
29 | /** |
||
30 | * |
||
31 | */ |
||
32 | public function testBlockForm() |
||
40 | |||
41 | /** |
||
42 | * |
||
43 | */ |
||
44 | View Code Duplication | public function testCanView() |
|
57 | |||
58 | /** |
||
59 | * |
||
60 | */ |
||
61 | View Code Duplication | public function testCanCreate() |
|
74 | } |
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.