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 | View Code Duplication | class PwzValidatorTest 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 getValidPwzNumbers |
||
48 | */ |
||
49 | public function testValidPwz($pwz) |
||
55 | |||
56 | /** |
||
57 | * @dataProvider getInvalidPwzNumbers |
||
58 | */ |
||
59 | public function testInvalidPwz($pwz) |
||
71 | |||
72 | /** |
||
73 | * @return array |
||
74 | */ |
||
75 | public function getValidPwzNumbers() |
||
87 | |||
88 | /** |
||
89 | * @return array |
||
90 | */ |
||
91 | public function getInvalidPwzNumbers() |
||
101 | |||
102 | /** |
||
103 | * @return PwzValidator |
||
104 | */ |
||
105 | protected function createValidator() |
||
109 | |||
110 | protected function getApiVersion() |
||
114 | } |
||
115 |
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.