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 KunstmaanAdminExtensionTest extends AbstractExtensionTestCase |
||
13 | { |
||
14 | /** |
||
15 | * @return ExtensionInterface[] |
||
|
|||
16 | */ |
||
17 | protected function getContainerExtensions() |
||
21 | |||
22 | public function testCorrectParametersHaveBeenSet() |
||
50 | |||
51 | /** |
||
52 | * @group legacy |
||
53 | * @expectedDeprecation Not providing a value for the "kunstmaan_admin.website_title" config is deprecated since KunstmaanAdminBundle 5.2, this config value will be required in KunstmaanAdminBundle 6.0. |
||
54 | */ |
||
55 | public function testWebsiteTitleWithParameterSet() |
||
63 | |||
64 | public function testWebsiteTitleWithParameterAndConfigSet() |
||
72 | |||
73 | /** |
||
74 | * @group legacy |
||
75 | * @expectedDeprecation Not providing a value for the "kunstmaan_admin.multi_language" config is deprecated since KunstmaanAdminBundle 5.2, this config value will be required in KunstmaanAdminBundle 6.0. |
||
76 | */ |
||
77 | public function testMultiLanguageWithParameterSet() |
||
85 | |||
86 | View Code Duplication | public function testMultiLanguageWithParameterAndConfigSet() |
|
94 | |||
95 | /** |
||
96 | * @group legacy |
||
97 | */ |
||
98 | View Code Duplication | public function testMultiLanguageScalarParameter() |
|
106 | |||
107 | /** |
||
108 | * @group legacy |
||
109 | * @expectedDeprecation Not providing a value for the "kunstmaan_admin.required_locales" config is deprecated since KunstmaanAdminBundle 5.2, this config value will be required in KunstmaanAdminBundle 6.0. |
||
110 | */ |
||
111 | public function testRequiredLocalesWithParameterSet() |
||
119 | |||
120 | public function testRequiredLocalesWithParameterAndConfigSet() |
||
128 | |||
129 | /** |
||
130 | * @group legacy |
||
131 | * @expectedDeprecation Not providing a value for the "kunstmaan_admin.default_locale" config is deprecated since KunstmaanAdminBundle 5.2, this config value will be required in KunstmaanAdminBundle 6.0. |
||
132 | */ |
||
133 | public function testDefaultLocaleWithParameterSet() |
||
141 | |||
142 | public function testDefaultLocaleWithParameterAndConfigSet() |
||
150 | |||
151 | /** |
||
152 | * @group legacy |
||
153 | * @expectedDeprecation Not providing a value for the "kunstmaan_admin.website_title" config is deprecated since KunstmaanAdminBundle 5.2, this config value will be required in KunstmaanAdminBundle 6.0. |
||
154 | * @expectedDeprecation Not providing a value for the "kunstmaan_admin.multi_language" config is deprecated since KunstmaanAdminBundle 5.2, this config value will be required in KunstmaanAdminBundle 6.0. |
||
155 | * @expectedDeprecation Not providing a value for the "kunstmaan_admin.required_locales" config is deprecated since KunstmaanAdminBundle 5.2, this config value will be required in KunstmaanAdminBundle 6.0. |
||
156 | * @expectedDeprecation Not providing a value for the "kunstmaan_admin.default_locale" config is deprecated since KunstmaanAdminBundle 5.2, this config value will be required in KunstmaanAdminBundle 6.0. |
||
157 | */ |
||
158 | public function testLegacyParameters() |
||
167 | |||
168 | protected function setUp() |
||
176 | |||
177 | private function getRequiredConfig(string $excludeKey = null) |
||
192 | } |
||
193 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.