diff --git a/.github/workflows/workflows.yml b/.github/workflows/workflows.yml
index 9f51de7..049dfea 100644
--- a/.github/workflows/workflows.yml
+++ b/.github/workflows/workflows.yml
@@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- php-versions: ['8.1', '8.2', '8.3']
+ php-versions: ['8.2', '8.3']
steps:
- uses: actions/checkout@v4
- uses: "shivammathur/setup-php@v2"
@@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- php-versions: ['8.1', '8.2', '8.3']
+ php-versions: ['8.2', '8.3']
steps:
- uses: actions/checkout@v4
- uses: "shivammathur/setup-php@v2"
@@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- php-versions: ['8.1', '8.2', '8.3']
+ php-versions: ['8.2', '8.3']
dependency-versions: ['highest', 'lowest']
steps:
- uses: actions/checkout@v4
diff --git a/composer.json b/composer.json
index ec4d4e8..1f3f9e8 100644
--- a/composer.json
+++ b/composer.json
@@ -4,7 +4,7 @@
"homepage": "https://github.com/previousnext/coding-standard",
"keywords": ["drupal", "phpcs"],
"require": {
- "php": "^8.1",
+ "php": "^8.2",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"drupal/coder": "^8.3.24",
"slevomat/coding-standard": "^8.15.0",
@@ -15,7 +15,7 @@
"phpstan/phpstan": "^1.11.3",
"phpstan/phpstan-deprecation-rules": "^1.2.0",
"phpstan/phpstan-strict-rules": "^1.6.0",
- "phpunit/phpunit": "^9.6.19"
+ "phpunit/phpunit": "^11"
},
"license": "MIT",
"autoload": {
diff --git a/phpcs.xml b/phpcs.xml
index 7e9a506..a2f0923 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -10,7 +10,10 @@
-
+
+
+ ./tests/*
+
./tests/*
diff --git a/phpunit.xml b/phpunit.xml
index afd25fe..1ee942f 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -1,19 +1,18 @@
-
-
-
- tests
-
-
+
+
+
+ tests
+
+
diff --git a/tests/Ignore/IgnoreDocCommentSniffTest.php b/tests/Ignore/IgnoreDocCommentSniffTest.php
index ef9fb05..1c41c48 100644
--- a/tests/Ignore/IgnoreDocCommentSniffTest.php
+++ b/tests/Ignore/IgnoreDocCommentSniffTest.php
@@ -4,9 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Ignore;
-/**
- * @covers \PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting\DocCommentSniff
- */
+use PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting\DocCommentSniff;
+use PHPUnit\Framework\Attributes\CoversClass;
+
+#[CoversClass(DocCommentSniff::class)]
final class IgnoreDocCommentSniffTest extends Base {
/**
diff --git a/tests/Ignore/IgnoreDrupalArraysArrayLongLineDeclarationTest.php b/tests/Ignore/IgnoreDrupalArraysArrayLongLineDeclarationTest.php
index 920640a..9fdfa5d 100644
--- a/tests/Ignore/IgnoreDrupalArraysArrayLongLineDeclarationTest.php
+++ b/tests/Ignore/IgnoreDrupalArraysArrayLongLineDeclarationTest.php
@@ -4,9 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Ignore;
-/**
- * @covers \Drupal\Sniffs\Arrays\ArraySniff
- */
+use Drupal\Sniffs\Arrays\ArraySniff;
+use PHPUnit\Framework\Attributes\CoversClass;
+
+#[CoversClass(ArraySniff::class)]
final class IgnoreDrupalArraysArrayLongLineDeclarationTest extends Base {
/**
diff --git a/tests/Ignore/IgnoreDrupalCommentingClassCommentShortTest.php b/tests/Ignore/IgnoreDrupalCommentingClassCommentShortTest.php
index 9e495da..c8cde9f 100644
--- a/tests/Ignore/IgnoreDrupalCommentingClassCommentShortTest.php
+++ b/tests/Ignore/IgnoreDrupalCommentingClassCommentShortTest.php
@@ -4,9 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Ignore;
-/**
- * @covers \Drupal\Sniffs\Commenting\ClassCommentSniff
- */
+use Drupal\Sniffs\Commenting\ClassCommentSniff;
+use PHPUnit\Framework\Attributes\CoversClass;
+
+#[CoversClass(ClassCommentSniff::class)]
final class IgnoreDrupalCommentingClassCommentShortTest extends Base {
/**
diff --git a/tests/Ignore/IgnoreDrupalCommentingFunctionCommentTest.php b/tests/Ignore/IgnoreDrupalCommentingFunctionCommentTest.php
index b57f259..b943b6c 100644
--- a/tests/Ignore/IgnoreDrupalCommentingFunctionCommentTest.php
+++ b/tests/Ignore/IgnoreDrupalCommentingFunctionCommentTest.php
@@ -4,9 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Ignore;
-/**
- * @covers \PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\FunctionCommentSniff
- */
+use PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\FunctionCommentSniff;
+use PHPUnit\Framework\Attributes\CoversClass;
+
+#[CoversClass(FunctionCommentSniff::class)]
final class IgnoreDrupalCommentingFunctionCommentTest extends Base {
/**
diff --git a/tests/Ignore/IgnoreDrupalCommentingTodoCommentTodoFormatTest.php b/tests/Ignore/IgnoreDrupalCommentingTodoCommentTodoFormatTest.php
index eac347a..f3d8f41 100644
--- a/tests/Ignore/IgnoreDrupalCommentingTodoCommentTodoFormatTest.php
+++ b/tests/Ignore/IgnoreDrupalCommentingTodoCommentTodoFormatTest.php
@@ -4,9 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Ignore;
-/**
- * @covers \Drupal\Sniffs\Commenting\TodoCommentSniff
- */
+use Drupal\Sniffs\Commenting\TodoCommentSniff;
+use PHPUnit\Framework\Attributes\CoversClass;
+
+#[CoversClass(TodoCommentSniff::class)]
final class IgnoreDrupalCommentingTodoCommentTodoFormatTest extends Base {
/**
diff --git a/tests/Ignore/IgnoreDrupalCommentingVariableCommentMissingTest.php b/tests/Ignore/IgnoreDrupalCommentingVariableCommentMissingTest.php
index 52bbb10..3a32955 100644
--- a/tests/Ignore/IgnoreDrupalCommentingVariableCommentMissingTest.php
+++ b/tests/Ignore/IgnoreDrupalCommentingVariableCommentMissingTest.php
@@ -4,9 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Ignore;
-/**
- * @covers \Drupal\Sniffs\Commenting\VariableCommentSniff
- */
+use Drupal\Sniffs\Commenting\VariableCommentSniff;
+use PHPUnit\Framework\Attributes\CoversClass;
+
+#[CoversClass(VariableCommentSniff::class)]
final class IgnoreDrupalCommentingVariableCommentMissingTest extends Base {
public function testIgnored(): void {
diff --git a/tests/Ignore/IgnoreUnreachableTest.php b/tests/Ignore/IgnoreUnreachableTest.php
index 9c194b8..99dfba7 100644
--- a/tests/Ignore/IgnoreUnreachableTest.php
+++ b/tests/Ignore/IgnoreUnreachableTest.php
@@ -4,9 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Ignore;
-/**
- * @covers \PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\NonExecutableCodeSniff
- */
+use PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\NonExecutableCodeSniff;
+use PHPUnit\Framework\Attributes\CoversClass;
+
+#[CoversClass(NonExecutableCodeSniff::class)]
final class IgnoreUnreachableTest extends Base {
public function testIgnored(): void {
diff --git a/tests/Sniffs/AlphabeticallySortedUsesTest.php b/tests/Sniffs/AlphabeticallySortedUsesTest.php
index 593b770..bf74e0c 100644
--- a/tests/Sniffs/AlphabeticallySortedUsesTest.php
+++ b/tests/Sniffs/AlphabeticallySortedUsesTest.php
@@ -4,11 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Sniffs;
+use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\Namespaces\AlphabeticallySortedUsesSniff;
-/**
- * @covers \SlevomatCodingStandard\Sniffs\Namespaces\AlphabeticallySortedUsesSniff
- */
+#[CoversClass(AlphabeticallySortedUsesSniff::class)]
final class AlphabeticallySortedUsesTest extends Base {
public function testNoError(): void {
diff --git a/tests/Sniffs/ClassStructureTest.php b/tests/Sniffs/ClassStructureTest.php
index d18f36e..6eb5fa4 100644
--- a/tests/Sniffs/ClassStructureTest.php
+++ b/tests/Sniffs/ClassStructureTest.php
@@ -4,11 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Sniffs;
+use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\Classes\ClassStructureSniff;
-/**
- * @covers \SlevomatCodingStandard\Sniffs\Classes\ClassStructureSniff
- */
+#[CoversClass(ClassStructureSniff::class)]
final class ClassStructureTest extends Base {
public function testNoError(): void {
diff --git a/tests/Sniffs/FullyQualifiedGlobalFunctionsTest.php b/tests/Sniffs/FullyQualifiedGlobalFunctionsTest.php
index e3bd05b..d50bec7 100644
--- a/tests/Sniffs/FullyQualifiedGlobalFunctionsTest.php
+++ b/tests/Sniffs/FullyQualifiedGlobalFunctionsTest.php
@@ -4,11 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Sniffs;
+use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedGlobalFunctionsSniff;
-/**
- * @covers \SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedGlobalFunctionsSniff
- */
+#[CoversClass(FullyQualifiedGlobalFunctionsSniff::class)]
final class FullyQualifiedGlobalFunctionsTest extends Base {
public function testNoError(): void {
diff --git a/tests/Sniffs/FunctionClosingBraceSpacingBeforeCloseTest.php b/tests/Sniffs/FunctionClosingBraceSpacingBeforeCloseTest.php
index 929700e..a01ac92 100644
--- a/tests/Sniffs/FunctionClosingBraceSpacingBeforeCloseTest.php
+++ b/tests/Sniffs/FunctionClosingBraceSpacingBeforeCloseTest.php
@@ -4,9 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Sniffs;
-/**
- * @covers \PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\FunctionOpeningBraceSpaceSniff
- */
+use PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\FunctionOpeningBraceSpaceSniff;
+use PHPUnit\Framework\Attributes\CoversClass;
+
+#[CoversClass(FunctionOpeningBraceSpaceSniff::class)]
final class FunctionClosingBraceSpacingBeforeCloseTest extends Base {
public function testNoError(): void {
diff --git a/tests/Sniffs/FunctionOpeningBraceSpaceSpacingAfterTest.php b/tests/Sniffs/FunctionOpeningBraceSpaceSpacingAfterTest.php
index 150a793..b9900a0 100644
--- a/tests/Sniffs/FunctionOpeningBraceSpaceSpacingAfterTest.php
+++ b/tests/Sniffs/FunctionOpeningBraceSpaceSpacingAfterTest.php
@@ -4,9 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Sniffs;
-/**
- * @covers \PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\FunctionOpeningBraceSpaceSniff
- */
+use PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\FunctionOpeningBraceSpaceSniff;
+use PHPUnit\Framework\Attributes\CoversClass;
+
+#[CoversClass(FunctionOpeningBraceSpaceSniff::class)]
final class FunctionOpeningBraceSpaceSpacingAfterTest extends Base {
public function testNoError(): void {
diff --git a/tests/Sniffs/FunctionsStaticClosureTest.php b/tests/Sniffs/FunctionsStaticClosureTest.php
index f9a0b70..587783e 100644
--- a/tests/Sniffs/FunctionsStaticClosureTest.php
+++ b/tests/Sniffs/FunctionsStaticClosureTest.php
@@ -4,9 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Sniffs;
-/**
- * @covers \SlevomatCodingStandard\Sniffs\Functions\StaticClosureSniff
- */
+use PHPUnit\Framework\Attributes\CoversClass;
+use SlevomatCodingStandard\Sniffs\Functions\StaticClosureSniff;
+
+#[CoversClass(StaticClosureSniff::class)]
final class FunctionsStaticClosureTest extends Base {
public function testNoError(): void {
diff --git a/tests/Sniffs/RequireMultiLineMethodSignatureTest.php b/tests/Sniffs/RequireMultiLineMethodSignatureTest.php
index f588e56..e739aed 100644
--- a/tests/Sniffs/RequireMultiLineMethodSignatureTest.php
+++ b/tests/Sniffs/RequireMultiLineMethodSignatureTest.php
@@ -4,9 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Sniffs;
-/**
- * @covers \SlevomatCodingStandard\Sniffs\Classes\RequireMultiLineMethodSignatureSniff
- */
+use PHPUnit\Framework\Attributes\CoversClass;
+use SlevomatCodingStandard\Sniffs\Classes\RequireMultiLineMethodSignatureSniff;
+
+#[CoversClass(RequireMultiLineMethodSignatureSniff::class)]
final class RequireMultiLineMethodSignatureTest extends Base {
public function testNoError(): void {
diff --git a/tests/Sniffs/RequireNullSafeObjectOperatorTest.php b/tests/Sniffs/RequireNullSafeObjectOperatorTest.php
index a719b81..8d1a8ba 100644
--- a/tests/Sniffs/RequireNullSafeObjectOperatorTest.php
+++ b/tests/Sniffs/RequireNullSafeObjectOperatorTest.php
@@ -4,11 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Sniffs;
+use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\ControlStructures\RequireNullSafeObjectOperatorSniff;
-/**
- * @covers \SlevomatCodingStandard\Sniffs\ControlStructures\RequireNullSafeObjectOperatorSniff
- */
+#[CoversClass(RequireNullSafeObjectOperatorSniff::class)]
final class RequireNullSafeObjectOperatorTest extends Base {
public function testNoError(): void {
diff --git a/tests/Sniffs/RequireTrailingCommaInCallTest.php b/tests/Sniffs/RequireTrailingCommaInCallTest.php
index ef0fbd7..66a2c4e 100644
--- a/tests/Sniffs/RequireTrailingCommaInCallTest.php
+++ b/tests/Sniffs/RequireTrailingCommaInCallTest.php
@@ -4,11 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Sniffs;
+use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\Functions\RequireTrailingCommaInDeclarationSniff;
-/**
- * @covers \SlevomatCodingStandard\Sniffs\Functions\RequireTrailingCommaInDeclarationSniff
- */
+#[CoversClass(RequireTrailingCommaInDeclarationSniff::class)]
final class RequireTrailingCommaInCallTest extends Base {
public function testNoError(): void {
diff --git a/tests/Sniffs/RequireTrailingCommaInDeclarationTest.php b/tests/Sniffs/RequireTrailingCommaInDeclarationTest.php
index 1ba2a20..6054ca7 100644
--- a/tests/Sniffs/RequireTrailingCommaInDeclarationTest.php
+++ b/tests/Sniffs/RequireTrailingCommaInDeclarationTest.php
@@ -4,9 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Sniffs;
-/**
- * @covers \SlevomatCodingStandard\Sniffs\Classes\RequireMultiLineMethodSignatureSniff
- */
+use PHPUnit\Framework\Attributes\CoversClass;
+use SlevomatCodingStandard\Sniffs\Classes\RequireMultiLineMethodSignatureSniff;
+
+#[CoversClass(RequireMultiLineMethodSignatureSniff::class)]
final class RequireTrailingCommaInDeclarationTest extends Base {
public function testNoError(): void {
diff --git a/tests/Sniffs/ReturnTypeHintSpacingTest.php b/tests/Sniffs/ReturnTypeHintSpacingTest.php
index 0c2e072..a7edb01 100644
--- a/tests/Sniffs/ReturnTypeHintSpacingTest.php
+++ b/tests/Sniffs/ReturnTypeHintSpacingTest.php
@@ -4,11 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Sniffs;
+use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSpacingSniff;
-/**
- * @covers \SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSpacingSniff
- */
+#[CoversClass(ReturnTypeHintSpacingSniff::class)]
final class ReturnTypeHintSpacingTest extends Base {
public function testNoError(): void {
diff --git a/tests/Sniffs/ReturnTypeHintTest.php b/tests/Sniffs/ReturnTypeHintTest.php
index aef5bba..86f220c 100644
--- a/tests/Sniffs/ReturnTypeHintTest.php
+++ b/tests/Sniffs/ReturnTypeHintTest.php
@@ -4,12 +4,13 @@
namespace PreviousNext\CodingStandard\Tests\Sniffs;
+use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff;
/**
- * @covers \SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff
* @see https://github.com/slevomat/coding-standard/blob/master/doc/type-hints.md#slevomatcodingstandardtypehintsreturntypehint-
*/
+#[CoversClass(ReturnTypeHintSniff::class)]
final class ReturnTypeHintTest extends Base {
public function testNoError(): void {
@@ -20,7 +21,7 @@ public function testNoError(): void {
/**
* Ensures traversables do not need to be fully documented.
*
- * @covers \SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff::CODE_MISSING_TRAVERSABLE_TYPE_HINT_SPECIFICATION
+ * @see \SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff::CODE_MISSING_TRAVERSABLE_TYPE_HINT_SPECIFICATION
*/
public function testIgnoreTraversable(): void {
$report = self::checkFile(__DIR__ . '/fixtures/ReturnTypeHintIgnoreTraversable.php');
diff --git a/tests/Sniffs/StrictTypesTest.php b/tests/Sniffs/StrictTypesTest.php
index 62d260a..1d2d569 100644
--- a/tests/Sniffs/StrictTypesTest.php
+++ b/tests/Sniffs/StrictTypesTest.php
@@ -4,11 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Sniffs;
+use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\TypeHints\DeclareStrictTypesSniff;
-/**
- * @covers \SlevomatCodingStandard\Sniffs\TypeHints\DeclareStrictTypesSniff
- */
+#[CoversClass(DeclareStrictTypesSniff::class)]
final class StrictTypesTest extends Base {
public function testNoError(): void {
diff --git a/tests/Sniffs/UnusedInheritedVariablePassedToClosureTest.php b/tests/Sniffs/UnusedInheritedVariablePassedToClosureTest.php
index 9cd7409..8b69bb2 100644
--- a/tests/Sniffs/UnusedInheritedVariablePassedToClosureTest.php
+++ b/tests/Sniffs/UnusedInheritedVariablePassedToClosureTest.php
@@ -4,11 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Sniffs;
+use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\Functions\UnusedInheritedVariablePassedToClosureSniff;
-/**
- * @covers \SlevomatCodingStandard\Sniffs\Functions\UnusedInheritedVariablePassedToClosureSniff
- */
+#[CoversClass(UnusedInheritedVariablePassedToClosureSniff::class)]
final class UnusedInheritedVariablePassedToClosureTest extends Base {
public function testNoError(): void {
diff --git a/tests/Sniffs/UselessInheritDocCommentTest.php b/tests/Sniffs/UselessInheritDocCommentTest.php
index e924ea6..50e1d99 100644
--- a/tests/Sniffs/UselessInheritDocCommentTest.php
+++ b/tests/Sniffs/UselessInheritDocCommentTest.php
@@ -4,11 +4,10 @@
namespace PreviousNext\CodingStandard\Tests\Sniffs;
+use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\Commenting\UselessInheritDocCommentSniff;
-/**
- * @covers \SlevomatCodingStandard\Sniffs\Commenting\UselessInheritDocCommentSniff
- */
+#[CoversClass(UselessInheritDocCommentSniff::class)]
final class UselessInheritDocCommentTest extends Base {
public function testNoError(): void {