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 RecentBlogPostsBlockTest 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 testGetCMSFields() |
||
| 20 | |||
| 21 | /** |
||
| 22 | * |
||
| 23 | */ |
||
| 24 | View Code Duplication | public function testCanView() |
|
| 32 | |||
| 33 | /** |
||
| 34 | * |
||
| 35 | */ |
||
| 36 | View Code Duplication | public function testCanCreate() |
|
| 44 | } |
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.