Skip to content

Commit 44bf9e3

Browse files
authored
refactor(ElseIf): Replace sniff with upstream PSR2 version (#3559491)
1 parent 1856376 commit 44bf9e3

File tree

7 files changed

+14
-121
lines changed

7 files changed

+14
-121
lines changed

.github/workflows/testing.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,5 @@ jobs:
101101
sed -i '/<rule ref="Drupal.WhiteSpace.Namespace"\/>/d' phpcs.xml.dist
102102
sed -i 's/Drupal.Classes.InterfaceName/Generic.NamingConventions.InterfaceNameSuffix/g' phpcs.xml.dist
103103
sed -i '/<rule ref="Drupal.Commenting.DataTypeNamespace"\/>/d' phpcs.xml.dist
104+
sed -i 's/Drupal.ControlStructures.ElseIf/PSR2.ControlStructures.ElseIfDeclaration/g' phpcs.xml.dist
104105
../../vendor/bin/phpcs -p -s --parallel=$(nproc) --exclude=Drupal.ControlStructures.ControlSignature --ignore=lib/Drupal/Core/Command/GenerateTheme.php,modules/mysql/tests/src/Kernel/mysql/Console/DbDumpCommandTest.php,modules/big_pipe/tests/modules/big_pipe_test/src/BigPipePlaceholderTestCases.php,tests/fixtures/plugins/CustomPlugin.php,modules/package_manager/tests/modules/package_manager_test_api/src/ApiController.php,modules/views/tests/src/Kernel/Plugin/StyleGridTest.php

coder_sniffer/Drupal/Sniffs/ControlStructures/ElseIfSniff.php

Lines changed: 0 additions & 76 deletions
This file was deleted.

coder_sniffer/Drupal/ruleset.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
<!-- Already covered by Drupal.Classes.PropertyDeclaration.VarUsed. -->
115115
<exclude name="PSR2.Classes.PropertyDeclaration.VarUsed"/>
116116
</rule>
117+
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
117118
<rule ref="PSR2.ControlStructures.SwitchDeclaration">
118119
<!-- Disable some error messages that we do not want. -->
119120
<exclude name="PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE"/>

tests/Drupal/ControlStructures/ElseIfUnitTest.php

Lines changed: 0 additions & 44 deletions
This file was deleted.

tests/Drupal/bad/BadUnitTest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ protected function getErrorList(string $testFile): array
194194
216 => 2,
195195
218 => 1,
196196
222 => 2,
197-
225 => 2,
197+
225 => 1,
198198
230 => 1,
199199
233 => 1,
200200
237 => 1,
@@ -397,6 +397,11 @@ protected function getErrorList(string $testFile): array
397397
21 => 1,
398398
31 => 1,
399399
];
400+
case 'ElseIfUnitTest.inc':
401+
return [
402+
1 => 1,
403+
9 => 1,
404+
];
400405
case 'FinallySpacingUnitTest.inc':
401406
return [
402407
1 => 1,
@@ -473,6 +478,7 @@ protected function getWarningList(string $testFile): array
473478
156 => 1,
474479
193 => 1,
475480
202 => 1,
481+
225 => 1,
476482
360 => 1,
477483
363 => 1,
478484
366 => 1,
@@ -494,6 +500,11 @@ protected function getWarningList(string $testFile): array
494500
824 => 1,
495501
836 => 1,
496502
];
503+
case 'ElseIfUnitTest.inc':
504+
return [
505+
6 => 1,
506+
9 => 1,
507+
];
497508
}//end switch
498509

499510
return [];

0 commit comments

Comments
 (0)