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

---
 tests/integration/TypedTagsTest.php                    | 11 ++++++-----
 tests/unit/DocBlock/DescriptionFactoryTest.php         |  5 +++--
 tests/unit/DocBlock/StandardTagFactoryTest.php         |  9 +++------
 tests/unit/DocBlock/Tags/AuthorTest.php                |  3 ++-
 tests/unit/DocBlock/Tags/ExampleTest.php               |  5 +++--
 tests/unit/DocBlock/Tags/Factory/MethodFactoryTest.php |  3 ++-
 tests/unit/DocBlock/Tags/Factory/ParamFactoryTest.php  |  3 ++-
 tests/unit/DocBlock/Tags/MethodParameterTest.php       |  3 ++-
 tests/unit/DocBlock/Tags/MethodTest.php                |  3 ++-
 tests/unit/DocBlockFactoryTest.php                     |  3 ++-
 tests/unit/Exception/PcreExceptionTest.php             |  3 ++-
 11 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/tests/integration/TypedTagsTest.php b/tests/integration/TypedTagsTest.php
index b0f6d65..ca43c8f 100644
--- a/tests/integration/TypedTagsTest.php
+++ b/tests/integration/TypedTagsTest.php
@@ -22,6 +22,7 @@ use phpDocumentor\Reflection\Types\Nullable;
 use phpDocumentor\Reflection\Types\Object_;
 use phpDocumentor\Reflection\Types\String_;
 use phpDocumentor\Reflection\Types\Void_;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 
 /**
@@ -29,7 +30,7 @@ use PHPUnit\Framework\TestCase;
  */
 final class TypedTagsTest extends TestCase
 {
-    /** @dataProvider typeProvider */
+    #[DataProvider('typeProvider')]
     public function testParamFormats(string $type, Type $expectedType): void
     {
         $docblock = <<<DOCBLOCK
@@ -45,7 +46,7 @@ DOCBLOCK;
         $this->assertEquals($expectedType, $phpdoc->getTags()[0]->getType());
     }
 
-    /** @dataProvider typeProvider */
+    #[DataProvider('typeProvider')]
     public function testVarFormats(string $type, Type $expectedType): void
     {
         $docblock = <<<DOCBLOCK
@@ -61,7 +62,7 @@ DOCBLOCK;
         $this->assertEquals($expectedType, $phpdoc->getTags()[0]->getType());
     }
 
-    /** @dataProvider typeProvider */
+    #[DataProvider('typeProvider')]
     public function testMethodFormats(string $type, Type $expectedType): void
     {
         $docblock = <<<DOCBLOCK
@@ -78,7 +79,7 @@ DOCBLOCK;
         $this->assertEquals($expectedType, $phpdoc->getTags()[0]->getParameters()[0]->getType());
     }
 
-    /** @dataProvider invalidFormatsProvider */
+    #[DataProvider('invalidFormatsProvider')]
     public function testInvalidParam(string $type): void
     {
         $docblock = <<<DOCBLOCK
@@ -95,7 +96,7 @@ DOCBLOCK;
 
     }
 
-    /** @dataProvider invalidFormatsProvider */
+    #[DataProvider('invalidFormatsProvider')]
     public function testInvalidMethod(string $type): void
     {
         $docblock = <<<DOCBLOCK
diff --git a/tests/unit/DocBlock/DescriptionFactoryTest.php b/tests/unit/DocBlock/DescriptionFactoryTest.php
index ef00350..bfcfc74 100644
--- a/tests/unit/DocBlock/DescriptionFactoryTest.php
+++ b/tests/unit/DocBlock/DescriptionFactoryTest.php
@@ -18,6 +18,7 @@ use Mockery as m;
 use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag;
 use phpDocumentor\Reflection\DocBlock\Tags\Link as LinkTag;
 use phpDocumentor\Reflection\Types\Context;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 
 use function str_replace;
@@ -43,8 +44,8 @@ class DescriptionFactoryTest extends TestCase
      *
      * @covers ::__construct
      * @covers ::create
-     * @dataProvider provideSimpleExampleDescriptions
      */
+    #[DataProvider('provideSimpleExampleDescriptions')]
     public function testDescriptionCanParseASimpleString(string $contents): void
     {
         $tagFactory = m::mock(TagFactory::class);
@@ -61,8 +62,8 @@ class DescriptionFactoryTest extends TestCase
      *
      * @covers ::__construct
      * @covers ::create
-     * @dataProvider provideEscapeSequences
      */
+    #[DataProvider('provideEscapeSequences')]
     public function testEscapeSequences(string $contents, string $expected): void
     {
         $tagFactory = m::mock(TagFactory::class);
diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php
index 2606cc5..1428f81 100644
--- a/tests/unit/DocBlock/StandardTagFactoryTest.php
+++ b/tests/unit/DocBlock/StandardTagFactoryTest.php
@@ -30,6 +30,7 @@ use phpDocumentor\Reflection\Fqsen;
 use phpDocumentor\Reflection\FqsenResolver;
 use phpDocumentor\Reflection\TypeResolver;
 use phpDocumentor\Reflection\Types\Context;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 
 /**
@@ -463,9 +464,7 @@ class StandardTagFactoryTest extends TestCase
         $this->assertInstanceOf(InvalidTag::class, $tag);
     }
 
-    /**
-     * @dataProvider validTagProvider
-     */
+    #[DataProvider('validTagProvider')]
     public function testValidFormattedTags(string $input, string $tagName, string $render): void
     {
         $fqsenResolver = m::mock(FqsenResolver::class);
@@ -528,9 +527,7 @@ class StandardTagFactoryTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider invalidTagProvider
-     */
+    #[DataProvider('invalidTagProvider')]
     public function testInValidFormattedTags(string $input): void
     {
         $this->expectException(InvalidArgumentException::class);
diff --git a/tests/unit/DocBlock/Tags/AuthorTest.php b/tests/unit/DocBlock/Tags/AuthorTest.php
index e0e2a0b..9c7238e 100644
--- a/tests/unit/DocBlock/Tags/AuthorTest.php
+++ b/tests/unit/DocBlock/Tags/AuthorTest.php
@@ -14,6 +14,7 @@ declare(strict_types=1);
 namespace phpDocumentor\Reflection\DocBlock\Tags;
 
 use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 
 /**
@@ -150,8 +151,8 @@ class AuthorTest extends TestCase
      * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::<public>
      *
      * @covers ::create
-     * @dataProvider authorTagProvider
      */
+    #[DataProvider('authorTagProvider')]
     public function testFactoryMethod(string $input, string $output, string $name, string $email): void
     {
         $fixture = Author::create($input);
diff --git a/tests/unit/DocBlock/Tags/ExampleTest.php b/tests/unit/DocBlock/Tags/ExampleTest.php
index 4741778..a21ed95 100644
--- a/tests/unit/DocBlock/Tags/ExampleTest.php
+++ b/tests/unit/DocBlock/Tags/ExampleTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
 namespace phpDocumentor\Reflection\DocBlock\Tags;
 
 use InvalidArgumentException;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 
 /**
@@ -141,7 +142,6 @@ class ExampleTest extends TestCase
     /**
      * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
      *
-     * @dataProvider tagContentProvider
      * @covers ::create
      * @covers ::__construct
      * @covers ::getFilePath
@@ -150,6 +150,7 @@ class ExampleTest extends TestCase
      * @covers ::getDescription
      * @covers ::getContent
      */
+    #[DataProvider('tagContentProvider')]
     public function testFactoryMethod(
         string $input,
         string $filePath,
@@ -222,9 +223,9 @@ class ExampleTest extends TestCase
     }
 
     /**
-     * @dataProvider invalidExampleProvider
      * @covers ::__construct
      */
+    #[DataProvider('invalidExampleProvider')]
     public function testValidatesArguments(
         string $filePath,
         bool $isUrl,
diff --git a/tests/unit/DocBlock/Tags/Factory/MethodFactoryTest.php b/tests/unit/DocBlock/Tags/Factory/MethodFactoryTest.php
index 3c5c064..b41bf17 100644
--- a/tests/unit/DocBlock/Tags/Factory/MethodFactoryTest.php
+++ b/tests/unit/DocBlock/Tags/Factory/MethodFactoryTest.php
@@ -21,6 +21,7 @@ use phpDocumentor\Reflection\Types\Integer;
 use phpDocumentor\Reflection\Types\Mixed_;
 use phpDocumentor\Reflection\Types\String_;
 use phpDocumentor\Reflection\Types\Void_;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 final class MethodFactoryTest extends TagFactoryTestCase
 {
@@ -28,8 +29,8 @@ final class MethodFactoryTest extends TagFactoryTestCase
      * @covers \phpDocumentor\Reflection\DocBlock\Tags\Factory\MethodFactory::__construct
      * @covers \phpDocumentor\Reflection\DocBlock\Tags\Factory\MethodFactory::create
      * @covers \phpDocumentor\Reflection\DocBlock\Tags\Factory\MethodFactory::supports
-     * @dataProvider tagProvider
      */
+    #[DataProvider('tagProvider')]
     public function testIsCreated(string $tagLine, Method $tag): void
     {
         $ast = $this->parseTag($tagLine);
diff --git a/tests/unit/DocBlock/Tags/Factory/ParamFactoryTest.php b/tests/unit/DocBlock/Tags/Factory/ParamFactoryTest.php
index 9c7bac2..cd1fc8b 100644
--- a/tests/unit/DocBlock/Tags/Factory/ParamFactoryTest.php
+++ b/tests/unit/DocBlock/Tags/Factory/ParamFactoryTest.php
@@ -26,6 +26,7 @@ use phpDocumentor\Reflection\Types\Integer;
 use phpDocumentor\Reflection\Types\Mixed_;
 use phpDocumentor\Reflection\Types\Object_;
 use phpDocumentor\Reflection\Types\String_;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 final class ParamFactoryTest extends TagFactoryTestCase
 {
@@ -33,8 +34,8 @@ final class ParamFactoryTest extends TagFactoryTestCase
      * @covers \phpDocumentor\Reflection\DocBlock\Tags\Factory\ParamFactory::__construct
      * @covers \phpDocumentor\Reflection\DocBlock\Tags\Factory\ParamFactory::create
      * @covers \phpDocumentor\Reflection\DocBlock\Tags\Factory\ParamFactory::supports
-     * @dataProvider paramInputProvider
      */
+    #[DataProvider('paramInputProvider')]
     public function testParamIsCreated(string $input, Tag $expected): void
     {
         $ast = $this->parseTag($input);
diff --git a/tests/unit/DocBlock/Tags/MethodParameterTest.php b/tests/unit/DocBlock/Tags/MethodParameterTest.php
index 751b4a0..fe3ba23 100644
--- a/tests/unit/DocBlock/Tags/MethodParameterTest.php
+++ b/tests/unit/DocBlock/Tags/MethodParameterTest.php
@@ -23,6 +23,7 @@ use phpDocumentor\Reflection\Types\Integer;
 use phpDocumentor\Reflection\Types\Nullable;
 use phpDocumentor\Reflection\Types\Object_;
 use phpDocumentor\Reflection\Types\String_;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use stdClass;
 
@@ -66,10 +67,10 @@ class MethodParameterTest extends TestCase
      *
      * @param mixed $defaultValue
      *
-     * @dataProvider collectionDefaultValuesProvider
      * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
      * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
      */
+    #[DataProvider('collectionDefaultValuesProvider')]
     public function testIfTagCanBeRenderedUsingMethodParameterWithDefaultValue(
         Type $type,
         $defaultValue,
diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php
index d662158..35f03a9 100644
--- a/tests/unit/DocBlock/Tags/MethodTest.php
+++ b/tests/unit/DocBlock/Tags/MethodTest.php
@@ -27,6 +27,7 @@ use phpDocumentor\Reflection\Types\Object_;
 use phpDocumentor\Reflection\Types\String_;
 use phpDocumentor\Reflection\Types\This;
 use phpDocumentor\Reflection\Types\Void_;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 
 /**
@@ -429,9 +430,9 @@ class MethodTest extends TestCase
      * @uses         \phpDocumentor\Reflection\Types\Integer
      * @uses         \phpDocumentor\Reflection\Types\Object_
      *
-     * @dataProvider collectionReturnTypesProvider
      * @covers ::create
      */
+    #[DataProvider('collectionReturnTypesProvider')]
     public function testCollectionReturnTypes(
         string $returnType,
         string $expectedType,
diff --git a/tests/unit/DocBlockFactoryTest.php b/tests/unit/DocBlockFactoryTest.php
index 49a0762..977b365 100644
--- a/tests/unit/DocBlockFactoryTest.php
+++ b/tests/unit/DocBlockFactoryTest.php
@@ -20,6 +20,7 @@ use phpDocumentor\Reflection\DocBlock\Tag;
 use phpDocumentor\Reflection\DocBlock\TagFactory;
 use phpDocumentor\Reflection\DocBlock\Tags\Param;
 use phpDocumentor\Reflection\Types\Context;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ReflectionClass;
 
@@ -128,8 +129,8 @@ class DocBlockFactoryTest extends TestCase
      * @covers ::__construct
      * @covers ::create
      *
-     * @dataProvider provideSummaryAndDescriptions
      */
+    #[DataProvider('provideSummaryAndDescriptions')]
     public function testSummaryAndDescriptionAreSeparated(string $given, string $summary, string $description): void
     {
         $tagFactory = m::mock(TagFactory::class);
diff --git a/tests/unit/Exception/PcreExceptionTest.php b/tests/unit/Exception/PcreExceptionTest.php
index f979976..7eac76f 100644
--- a/tests/unit/Exception/PcreExceptionTest.php
+++ b/tests/unit/Exception/PcreExceptionTest.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 namespace phpDocumentor\Reflection\Exception;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 
 use const PREG_BACKTRACK_LIMIT_ERROR;
@@ -21,8 +22,8 @@ final class PcreExceptionTest extends TestCase
 {
     /**
      * @covers ::createFromPhpError
-     * @dataProvider errorCodeProvider
      */
+    #[DataProvider('errorCodeProvider')]
     public function testErrorConversion(int $errorCode, string $message): void
     {
         $this->assertSame($message, PcreException::createFromPhpError($errorCode)->getMessage());
