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 |
||
22 | class RegonValidatorTest extends AbstractConstraintValidatorTest |
||
|
|||
23 | { |
||
24 | public function testNullIsValid() |
||
30 | |||
31 | public function testEmptyStringIsValid() |
||
37 | |||
38 | /** |
||
39 | * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException |
||
40 | */ |
||
41 | public function testExpectsStringCompatibleType() |
||
45 | |||
46 | /** |
||
47 | * @dataProvider getValidRegonNumbers |
||
48 | */ |
||
49 | public function testValidRegon($regon) |
||
55 | |||
56 | /** |
||
57 | * @dataProvider getInvalidRegonNumbers |
||
58 | */ |
||
59 | View Code Duplication | public function testInvalidRegon($regon) |
|
71 | |||
72 | /** |
||
73 | * @return array |
||
74 | */ |
||
75 | public function getValidRegonNumbers() |
||
82 | |||
83 | /** |
||
84 | * @return array |
||
85 | */ |
||
86 | public function getInvalidRegonNumbers() |
||
100 | |||
101 | /** |
||
102 | * @return RegonValidator |
||
103 | */ |
||
104 | protected function createValidator() |
||
108 | |||
109 | protected function getApiVersion() |
||
113 | } |
||
114 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.