Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(FullyQualifiedNamespace): Replace sniff in favor of a sniff from Slevomat #199

Draft
wants to merge 3 commits into
base: 8.3.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
212 changes: 0 additions & 212 deletions coder_sniffer/Drupal/Sniffs/Classes/FullyQualifiedNamespaceSniff.php

This file was deleted.

18 changes: 17 additions & 1 deletion coder_sniffer/Drupal/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,22 @@

<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" />
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses" />
<!-- Allow global names with backslash like \Drupal. -->
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
<properties>
<property name="allowFullyQualifiedGlobalClasses" value="true" />
<property name="allowFullyQualifiedGlobalFunctions" value="true" />
<property name="allowFullyQualifiedGlobalConstants" value="true" />
<property name="allowFallbackGlobalFunctions" value="true" />
<property name="allowFallbackGlobalConstants" value="true" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName">
<exclude-pattern>*.api.php</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedNameWithoutNamespace">
<severity>0</severity>
</rule>
<rule ref="SlevomatCodingStandard.PHP.ShortList" />

<rule ref="Squiz.Arrays.ArrayDeclaration" />
Expand Down Expand Up @@ -298,7 +314,7 @@
<exclude-pattern>*/\.svn/*</exclude-pattern>
<exclude-pattern>*/\.hg/*</exclude-pattern>
<exclude-pattern>*/\.bzr/*</exclude-pattern>

<!-- Ignore minified CSS files.-->
<exclude-pattern>*\.min\.css$</exclude-pattern>
</ruleset>
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"ext-mbstring": "*",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1 || ^1.0.0",
"sirbrillig/phpcs-variable-analysis": "^2.11.7",
"slevomat/coding-standard": "^8.11",
"slevomat/coding-standard": "dev-master",
"squizlabs/php_codesniffer": "^3.7.1",
"symfony/yaml": ">=3.4.0"
},
Expand Down
78 changes: 0 additions & 78 deletions tests/Drupal/Classes/FullyQualifiedNamespaceUnitTest.php

This file was deleted.

4 changes: 3 additions & 1 deletion tests/Drupal/Commenting/ClassCommentUnitTest.inc.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* Testing class/trait comments.
*/

use Some\Attribute;

/**
*
*/
Expand Down Expand Up @@ -60,7 +62,7 @@ class WrongSpacing {
/**
* This is correct.
*/
#[Some\Attribute(foo: 'bar')]
#[Attribute(foo: 'bar')]
#[Other\Attribute(baz: 'qux')]
class DoubleAttribute {

Expand Down
4 changes: 3 additions & 1 deletion tests/Drupal/Commenting/FunctionCommentUnitTest.inc.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* Some function comment tests.
*/

use Some\Attribute;

/**
* Test.
*
Expand Down Expand Up @@ -579,7 +581,7 @@ class Test41 {
/**
* Method docblock.
*/
#[Some\Attribute(foo: 'bar')]
#[Attribute(foo: 'bar')]
#[Other\Attribute(baz: 'qux')]
public function method() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* without them.
* phpcs:disable Drupal.Commenting
*/

use Foo\Bar;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use Test\MultiLine as MultiLineAlias,
Test\MultiLineSecond;

/**
* Example.
* Example with lots of variations.
*/
class Example {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use Test\MultiLineSecond;
use Test\NotUsed;

/**
* Example.
* Example with lots of variations.
*/
class Example {

Expand Down
Loading