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 |
||
| 12 | class PokerSquaresCreateObjectTest extends TestCase |
||
| 13 | { |
||
| 14 | // /** |
||
| 15 | // * Construct object and verify that the object is instance of class |
||
| 16 | // */ |
||
| 17 | public function testCreateObjectPokerSquares() |
||
| 22 | |||
| 23 | // /** |
||
| 24 | // * Test empty $_POST array |
||
| 25 | // */ |
||
| 26 | public function testEmptyPost() |
||
| 34 | |||
| 35 | public function testTraitDeckName() |
||
| 42 | |||
| 43 | View Code Duplication | public function testTraitDeckDeckSize() |
|
| 50 | |||
| 51 | public function testTraitSetupName() |
||
| 58 | |||
| 59 | // public function testTraitSetupShuffleDeck() |
||
| 60 | // { |
||
| 61 | // $pokersquares = new PokerSquares(); |
||
| 62 | // |
||
| 63 | // $pokersquares->shuffleDeck(); |
||
| 64 | |||
| 65 | // $exp = 52; |
||
| 66 | // $res = count(session('deck')); |
||
| 67 | // |
||
| 68 | // $this->assertEquals($exp, 52); |
||
| 69 | // |
||
| 70 | // } |
||
| 71 | |||
| 72 | } |
||
| 73 |
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.