Skip to content

Commit caec767

Browse files
authored
refactor(UseLeadingBackslash): Replace sniff with upstream version from Slevomat (#3554461)
1 parent 7a268e6 commit caec767

File tree

6 files changed

+6
-75
lines changed

6 files changed

+6
-75
lines changed

.github/workflows/testing.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ jobs:
8787
sed -i 's/Drupal.Classes.UnusedUseStatement/SlevomatCodingStandard.Namespaces.UnusedUses/g' phpcs.xml.dist
8888
sed -i '/<rule ref="SlevomatCodingStandard.Exceptions.RequireNonCapturingCatch" \/>/a \ <rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/>' phpcs.xml.dist
8989
sed -i 's@<rule ref="Drupal.Classes.ClassFileName"/>@<rule ref="Squiz.Classes.ClassFileName">\n <!-- Disable class name to file name matching for *Test.php files. -->\n <exclude-pattern>*/tests/*/*(Test|TestBase).php</exclude-pattern>\n </rule>@' phpcs.xml.dist
90+
sed -i 's/Drupal.Classes.UseLeadingBackslash/SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash/g' phpcs.xml.dist
9091
find . -type f -name "*.php" -exec sed -i 's#// phpcs:ignore Drupal.Classes.PropertyDeclaration, Drupal.NamingConventions.ValidVariableName.LowerCamelName, Drupal.Commenting.VariableComment.Missing#// phpcs:ignore Drupal.NamingConventions.ValidVariableName.LowerCamelName,PSR2.Classes.PropertyDeclaration.Underscore#g' {} +
9192
find . -type f -name "*.php" -exec sed -i 's#// @codingStandardsIgnoreLine#// phpcs:ignore#g' {} +
9293
find . -type f -name "*.php" -exec sed -i 's#// @codingStandardsIgnoreFile#// phpcs:ignoreFile#g' {} +

coder_sniffer/Drupal/Sniffs/Classes/UseLeadingBackslashSniff.php

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

coder_sniffer/Drupal/ruleset.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses"/>
137137
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/>
138138
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"/>
139+
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
139140
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/>
140141
<rule ref="SlevomatCodingStandard.PHP.ShortList"/>
141142
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">

tests/Drupal/bad/BadUnitTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,10 @@ protected function getErrorList(string $testFile): array
404404
85 => 1,
405405
98 => 1,
406406
];
407+
case 'UseLeadingBackslashUnitTest.inc':
408+
return [
409+
8 => 1,
410+
];
407411
case 'WrongClassName.php':
408412
return [
409413
6 => 1,

0 commit comments

Comments
 (0)