Skip to content
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,5 @@ jobs:
sed -i 's/Drupal.Methods.MethodDeclaration/PSR2.Methods.MethodDeclaration/g' phpcs.xml.dist
sed -i '/<rule ref="Drupal.WhiteSpace.Namespace"\/>/d' phpcs.xml.dist
sed -i 's/Drupal.Classes.InterfaceName/Generic.NamingConventions.InterfaceNameSuffix/g' phpcs.xml.dist
sed -i '/<rule ref="Drupal.Commenting.DataTypeNamespace"\/>/d' phpcs.xml.dist
../../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
103 changes: 0 additions & 103 deletions coder_sniffer/Drupal/Sniffs/Commenting/DataTypeNamespaceSniff.php

This file was deleted.

1 change: 1 addition & 0 deletions coder_sniffer/Drupal/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
</rule>
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses"/>
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/>
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation"/>
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"/>
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/>
Expand Down
46 changes: 0 additions & 46 deletions tests/Drupal/Commenting/DataTypeNamespaceUnitTest.php

This file was deleted.

4 changes: 2 additions & 2 deletions tests/Drupal/Commenting/DocCommentUnitTest.inc.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @return bool
* Returns FALSE.
*
* @throws Exception
* @throws \Exception
* Thrown when $param is TRUE.
*
* @ingroup sniffer
Expand Down Expand Up @@ -97,7 +97,7 @@ function test12() {
* | Unseen University | Mustrum Ridcully | Alberto Malich the Wise | 1281 AM | Nvnc Id Vides, Nvnc Ne Vides |
* phpcs:enable
*
* @param TableNode $organisation_table
* @param \TableNode $organisation_table
* The organisation data.
*
* @Given (the following )organisations:
Expand Down
36 changes: 18 additions & 18 deletions tests/Drupal/Commenting/FunctionCommentUnitTest.inc.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ function test21($arg1, $arg2, $arg3) {
*
* @param array|bool|float|int|mixed|object|string|resource|callable $arg1
* All of the above types are valid.
* @param array|bool|int|string|null $arg2
* @param array|bool|int|\str|null $arg2
* All of the above types are invalid.
* @param array|bool|int|string $arg3
* All of the above types are invalid.
* @param mixed $arg4
* @param \type $arg4
* All of the above types are invalid.
* @param false|true|int $arg5
* All of the above types are invalid.
Expand Down Expand Up @@ -536,7 +536,7 @@ function test37(array $matches, array $sub_key, $to) {
/**
* Yield from should be a recognised return statement.
*
* @return Generator
* @return \Generator
* Generator value.
*/
function test38($a, $b) {
Expand Down Expand Up @@ -605,7 +605,7 @@ class Test41 {
* NULL.
* @param float $param8
* Float.
* @param double $param9
* @param \double $param9
* Double.
* @param scalar $param10
* Scalar.
Expand Down Expand Up @@ -685,15 +685,15 @@ function test_return_void2(): void {
/**
* PHPStan: General arrays.
*
* @param Type[] $param1
* @param \Type[] $param1
* Parameter.
* @param array<Type> $param2
* @param array<\Type> $param2
* Parameter.
* @param array<int, Type> $param3
* @param array<int, \Type> $param3
* Parameter.
* @param non-empty-array<Type> $param4
* @param non-empty-array<\Type> $param4
* Parameter.
* @param non-empty-array<int, Type> $param5
* @param non-empty-array<int, \Type> $param5
* Parameter.
*
* @see https://phpstan.org/writing-php-code/phpdoc-types#general-arrays
Expand All @@ -702,39 +702,39 @@ function test_arrays(array $param1, array $param2, array $param3, array $param4,
}

/**
* @return Type[]
* @return \Type[]
* Square brackets.
*/
function test_return_type_array(): array {
return [];
}

/**
* @return array<Type>
* @return array<\Type>
* Arrow brackets.
*/
function test_return_arrow_array(): array {
return [];
}

/**
* @return array<int, Type>
* @return array<int, \Type>
* Keyed array.
*/
function test_return_keyed_array(): array {
return [];
}

/**
* @return non-empty-array<Type>
* @return non-empty-array<\Type>
* Non empty array with type.
*/
function test_return_non_empty_array(): array {
return [new Type()];
}

/**
* @return non-empty-array<int, Type>
* @return non-empty-array<int, \Type>
* Non empty keyed array with type.
*/
function test_return_non_empty_keyed_array(): array {
Expand Down Expand Up @@ -854,7 +854,7 @@ function test_return_integer_max(): int {
*
* @param class-string $param1
* Parameter.
* @param class-string<Foo> $param2
* @param class-string<\Foo> $param2
* Parameter.
* @param callable-string $param3
* Parameter.
Expand Down Expand Up @@ -883,7 +883,7 @@ function test_return_class_string(): string {
}

/**
* @return class-string<Foo>
* @return class-string<\Foo>
* Class string.
*/
function test_return_class_string_foo(): string {
Expand Down Expand Up @@ -933,10 +933,10 @@ function test_return_literal_string(): string {
/**
* PHP 8 intersection types are ok.
*
* @param Foo&Bar $a
* @param \Foo&\Bar $a
* Intersection type parameter.
*
* @return Foo&Bar
* @return \Foo&\Bar
* Intersection type return declaration.
*/
function test_intersection_types(Foo&Bar $a): Foo&Bar {
Expand Down
4 changes: 2 additions & 2 deletions tests/Drupal/Commenting/VariableCommentUnitTest.inc.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Test {
/**
* Property fooBar.
*
* @var Foo|Bar|false|null
* @var \Foo|\Bar|false|null
*/
public Foo|Bar|FALSE|NULL $fooBar;

Expand All @@ -84,7 +84,7 @@ class Test {
/**
* PHPStan constant wildcard.
*
* @var Foo::*
* @var \Foo::*
*/
protected string $constant;

Expand Down
14 changes: 12 additions & 2 deletions tests/Drupal/bad/BadUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ protected function getErrorList(string $testFile): array
638 => 1,
646 => 2,
648 => 1,
656 => 1,
656 => 2,
658 => 1,
661 => 1,
661 => 2,
671 => 1,
678 => 1,
685 => 1,
Expand Down Expand Up @@ -387,6 +387,14 @@ protected function getErrorList(string $testFile): array
13 => 2,
14 => 2,
16 => 1,
26 => 1,
31 => 1,
];
case 'DataTypeNamespaceUnitTest.inc':
return [
15 => 1,
18 => 1,
21 => 1,
31 => 1,
];
case 'FinallySpacingUnitTest.inc':
Expand Down Expand Up @@ -421,8 +429,10 @@ protected function getErrorList(string $testFile): array
22 => 1,
23 => 1,
35 => 1,
42 => 1,
56 => 1,
85 => 1,
87 => 1,
98 => 1,
];
case 'UseLeadingBackslashUnitTest.inc':
Expand Down
2 changes: 1 addition & 1 deletion tests/Drupal/bad/ClassCreateInstanceUnitTest.inc.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ClassCreateInstanceUnitTest {
/**
* Using PHP 7 return type hints is fine.
*
* @return ValidatorInterface[]
* @return \ValidatorInterface[]
* The validators.
*/
public function getValidators(): array {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use Some\Namespaced\TestClass;
/**
* Test.
*/
class Test {
class DataTypeNamespaceUnitTest {

/**
* Param and Return data types should be fully namespaced.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use Some\Namespaced\TestClass;
/**
* Test.
*/
class Test {
class DataTypeNamespaceUnitTest {

/**
* Param and Return data types should be fully namespaced.
Expand Down
Loading