From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Mon, 17 Feb 2025 15:59:34 +0100
Subject: Modernize PHPUnit syntax

---
 tests/AssertTest.php      | 35 +++++++++++------------------------
 tests/ProjectCodeTest.php | 18 ++++++++----------
 2 files changed, 19 insertions(+), 34 deletions(-)

diff --git a/tests/AssertTest.php b/tests/AssertTest.php
index 59c9b7b..eb88abb 100644
--- a/tests/AssertTest.php
+++ b/tests/AssertTest.php
@@ -16,6 +16,8 @@ use ArrayObject;
 use Error;
 use Exception;
 use LogicException;
+use PHPUnit\Framework\Attributes\AfterClass;
+use PHPUnit\Framework\Attributes\Group;
 use PHPUnit\Framework\TestCase;
 use RuntimeException;
 use stdClass;
@@ -42,6 +44,7 @@ class AssertTest extends TestCase
     /**
      * @afterClass
      */
+    #[AfterClass()]
     public static function doTearDownAfterClass()
     {
         //@fclose(self::$resource);
@@ -602,9 +605,7 @@ class AssertTest extends TestCase
         return array_values($methods);
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testAssert($method, $args, $success, $multibyte = false, $minVersion = null)
     {
         if ($minVersion && PHP_VERSION_ID < $minVersion) {
@@ -624,9 +625,7 @@ class AssertTest extends TestCase
         $this->addToAssertionCount(1);
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testNullOr($method, $args, $success, $multibyte = false, $minVersion = null)
     {
         if ($minVersion && PHP_VERSION_ID < $minVersion) {
@@ -646,18 +645,14 @@ class AssertTest extends TestCase
         $this->addToAssertionCount(1);
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testNullOrAcceptsNull($method)
     {
         call_user_func(array('Webmozart\Assert\Assert', 'nullOr'.ucfirst($method)), null, null, null);
         $this->addToAssertionCount(1);
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testAllArray($method, $args, $success, $multibyte = false, $minVersion = null)
     {
         if ($minVersion && PHP_VERSION_ID < $minVersion) {
@@ -680,9 +675,7 @@ class AssertTest extends TestCase
         $this->addToAssertionCount(1);
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testAllNullOrArray($method, $args, $success, $multibyte = false, $minVersion = null)
     {
         if ($minVersion && PHP_VERSION_ID < $minVersion) {
@@ -712,9 +705,7 @@ class AssertTest extends TestCase
         $this->addToAssertionCount(1);
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testAllTraversable($method, $args, $success, $multibyte = false, $minVersion = null)
     {
         if ($minVersion && PHP_VERSION_ID < $minVersion) {
@@ -762,9 +753,7 @@ class AssertTest extends TestCase
         );
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testConvertValuesToStrings($method, $args, $exceptionMessage)
     {
         $this->expectException('\InvalidArgumentException');
@@ -808,9 +797,7 @@ class AssertTest extends TestCase
         );
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testIsAOfExceptionMessages(array $args, string $exceptionMessage): void
     {
         $this->expectException('\InvalidArgumentException');
diff --git a/tests/ProjectCodeTest.php b/tests/ProjectCodeTest.php
index a0c2fe7..777a62c 100644
--- a/tests/ProjectCodeTest.php
+++ b/tests/ProjectCodeTest.php
@@ -2,6 +2,8 @@
 
 namespace Webmozart\Assert\Tests;
 
+use PHPUnit\Framework\Attributes\BeforeClass;
+use PHPUnit\Framework\Attributes\Group;
 use PHPUnit\Framework\TestCase;
 use ReflectionClass;
 use ReflectionMethod;
@@ -19,6 +21,7 @@ class ProjectCodeTest extends TestCase
     /**
      * @beforeClass
      */
+    #[BeforeClass()]
     public static function doSetUpBeforeClass()
     {
         self::$readmeContent = file_get_contents(__DIR__.'/../README.md');
@@ -33,10 +36,9 @@ class ProjectCodeTest extends TestCase
     }
 
     /**
-     * @group nophpunit11
-     *
      * @param string $method
      */
+    #[Group('nophpunit11')]
     public function testHasNullOr($method)
     {
         $fullMethodName = 'nullOr'.ucfirst($method);
@@ -62,10 +64,9 @@ class ProjectCodeTest extends TestCase
     }
 
     /**
-     * @group nophpunit11
-     *
      * @param string $method
      */
+    #[Group('nophpunit11')]
     public function testHasAll($method)
     {
         $fullMethodName = 'all'.ucfirst($method);
@@ -86,10 +87,9 @@ class ProjectCodeTest extends TestCase
     }
 
     /**
-     * @group nophpunit11
-     *
      * @param string $method
      */
+    #[Group('nophpunit11')]
     public function testIsInReadme($method)
     {
         $correct = strpos((string) self::$readmeContent, $method);
@@ -104,10 +104,9 @@ class ProjectCodeTest extends TestCase
     }
 
     /**
-     * @group nophpunit11
-     *
      * @param ReflectionMethod $method
      */
+    #[Group('nophpunit11')]
     public function testHasThrowsAnnotation($method)
     {
         $doc = $method->getDocComment();
@@ -131,10 +130,9 @@ class ProjectCodeTest extends TestCase
     }
 
     /**
-     * @group nophpunit11
-     *
      * @param ReflectionMethod $method
      */
+    #[Group('nophpunit11')]
     public function testHasCorrespondingStaticAnalysisFile($method)
     {
         $doc = $method->getDocComment();
