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 PeselValidatorTest extends AbstractConstraintValidatorTest |
||
|
|||
23 | { |
||
24 | /** |
||
25 | * @return PeselValidator |
||
26 | */ |
||
27 | protected function createValidator() |
||
31 | |||
32 | public function testNullIsValid() |
||
38 | |||
39 | public function testEmptyStringIsValid() |
||
45 | |||
46 | /** |
||
47 | * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException |
||
48 | */ |
||
49 | public function testExpectsStringCompatibleType() |
||
53 | |||
54 | /** |
||
55 | * @dataProvider getNoneStrictValidPeselNumbers |
||
56 | */ |
||
57 | public function testValidPesel($pesel) |
||
63 | |||
64 | /** |
||
65 | * @dataProvider getStrictValidPeselNumbers |
||
66 | */ |
||
67 | public function testValidPeselStrict($pesel) |
||
75 | |||
76 | /** |
||
77 | * @dataProvider getNoneStrictInvalidPeselNumbers |
||
78 | */ |
||
79 | View Code Duplication | public function testInvalidPesel($pesel) |
|
91 | |||
92 | /** |
||
93 | * @dataProvider getStrictInvalidPeselNumbers |
||
94 | */ |
||
95 | View Code Duplication | public function testInvalidPeselStrict($pesel) |
|
108 | |||
109 | /** |
||
110 | * @return array |
||
111 | */ |
||
112 | public function getNoneStrictValidPeselNumbers() |
||
119 | |||
120 | /** |
||
121 | * @return array |
||
122 | */ |
||
123 | public function getStrictValidPeselNumbers() |
||
129 | |||
130 | /** |
||
131 | * @return array |
||
132 | */ |
||
133 | public function getNoneStrictInvalidPeselNumbers() |
||
142 | |||
143 | /** |
||
144 | * @return array |
||
145 | */ |
||
146 | public function getStrictInvalidPeselNumbers() |
||
152 | |||
153 | protected function getApiVersion() |
||
157 | } |
||
158 |
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.