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 |
||
| 20 | class MutexAdapterTest extends \PHPUnit_Framework_TestCase |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * @var \Phake_IMock |
||
| 24 | */ |
||
| 25 | protected $mutex; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var \Phake_IMock |
||
| 29 | */ |
||
| 30 | protected $mutexAdapter; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * |
||
| 34 | */ |
||
| 35 | public function setUp() |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @test |
||
| 43 | */ |
||
| 44 | public function shouldAcquireMutex() |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @test |
||
| 54 | */ |
||
| 55 | View Code Duplication | public function shouldThrowAnExceptionIfMutexIsAlreadyAcquired() |
|
| 64 | |||
| 65 | /** |
||
| 66 | * @test |
||
| 67 | */ |
||
| 68 | View Code Duplication | public function shouldReleaseMutex() |
|
| 75 | |||
| 76 | /** |
||
| 77 | * @test |
||
| 78 | */ |
||
| 79 | View Code Duplication | public function shouldThrowAnExceptionIfCantReleaseTheMutex() |
|
| 88 | } |
||
| 89 |
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.