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/ModifyBackTraceSafeTest.php                | 11 ++++-------
 tests/integration/TypedTagsTest.php                          | 11 ++++++-----
 tests/unit/DocBlock/DescriptionFactoryTest.php               |  5 +++--
 tests/unit/DocBlock/StandardTagFactoryTest.php               | 12 ++++--------
 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 ++-
 .../DocBlock/Tags/Factory/TemplateCovariantFactoryTest.php   |  3 ++-
 tests/unit/DocBlock/Tags/Factory/TemplateFactoryTest.php     |  3 ++-
 tests/unit/DocBlock/Tags/MethodParameterTest.php             |  3 ++-
 tests/unit/DocBlockFactoryTest.php                           |  3 ++-
 tests/unit/Exception/PcreExceptionTest.php                   |  3 ++-
 13 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/tests/integration/ModifyBackTraceSafeTest.php b/tests/integration/ModifyBackTraceSafeTest.php
index 09c51ab..81a301c 100644
--- a/tests/integration/ModifyBackTraceSafeTest.php
+++ b/tests/integration/ModifyBackTraceSafeTest.php
@@ -4,17 +4,14 @@ declare(strict_types=1);
 
 namespace phpDocumentor\Reflection;
 
-
+use PHPUnit\Framework\Attributes\CoversNothing;
+use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
 use PHPUnit\Framework\TestCase;
 
-/**
- * @coversNothing
- */
+#[CoversNothing]
 class ModifyBackTraceSafeTest extends TestCase
 {
-    /**
-     * @doesNotPerformAssertions
-     */
+    #[DoesNotPerformAssertions]
     public function testBackTraceModificationDoesNotImpactFunctionArguments()
     {
         $traverser = new Traverser();
diff --git a/tests/integration/TypedTagsTest.php b/tests/integration/TypedTagsTest.php
index 2151712..938cabb 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, current($phpdoc->getTags()[0]->getParameters())->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 9fce0ff..1ccfbd7 100644
--- a/tests/unit/DocBlock/DescriptionFactoryTest.php
+++ b/tests/unit/DocBlock/DescriptionFactoryTest.php
@@ -17,6 +17,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;
@@ -42,8 +43,8 @@ class DescriptionFactoryTest extends TestCase
      *
      * @covers ::__construct
      * @covers ::create
-     * @dataProvider provideSimpleExampleDescriptions
      */
+    #[DataProvider('provideSimpleExampleDescriptions')]
     public function testDescriptionCanParseASimpleString(string $contents): void
     {
         $tagFactory = m::mock(TagFactory::class);
@@ -60,8 +61,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 3ddc0c4..f9ee0f7 100644
--- a/tests/unit/DocBlock/StandardTagFactoryTest.php
+++ b/tests/unit/DocBlock/StandardTagFactoryTest.php
@@ -43,6 +43,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;
 
 /**
@@ -464,9 +465,7 @@ class StandardTagFactoryTest extends TestCase
         $this->assertSame('deprecated', $tag->getName());
     }
 
-    /**
-     * @dataProvider validTagProvider
-     */
+    #[DataProvider('validTagProvider')]
     public function testValidFormattedTags(string $input, string $tagName, string $render): void
     {
         $fqsenResolver = m::mock(FqsenResolver::class);
@@ -534,9 +533,7 @@ class StandardTagFactoryTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider invalidTagProvider
-     */
+    #[DataProvider('invalidTagProvider')]
     public function testInValidFormattedTags(string $input): void
     {
         $this->expectException(InvalidArgumentException::class);
@@ -560,9 +557,8 @@ class StandardTagFactoryTest extends TestCase
 
     /**
      * @param class-string $expectedClass
-     *
-     * @dataProvider provideCreateWithTagWithTypesData
      */
+    #[DataProvider('provideCreateWithTagWithTypesData')]
     public function testCreateWithTagWithTypes(string $input, string $expectedClass): void
     {
         $tagFactory = StandardTagFactory::createInstance(new FqsenResolver());
diff --git a/tests/unit/DocBlock/Tags/AuthorTest.php b/tests/unit/DocBlock/Tags/AuthorTest.php
index 746ac69..30f90d1 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;
 
 /**
@@ -152,8 +153,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 7fab625..076b600 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;
 
 /**
@@ -146,7 +147,6 @@ class ExampleTest extends TestCase
     /**
      * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
      *
-     * @dataProvider tagContentProvider
      * @covers ::create
      * @covers ::__construct
      * @covers ::getFilePath
@@ -155,6 +155,7 @@ class ExampleTest extends TestCase
      * @covers ::getDescription
      * @covers ::getContent
      */
+    #[DataProvider('tagContentProvider')]
     public function testFactoryMethod(
         string $input,
         string $filePath,
@@ -228,9 +229,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 16ee17a..f0168b6 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 0a68906..4e383d4 100644
--- a/tests/unit/DocBlock/Tags/Factory/ParamFactoryTest.php
+++ b/tests/unit/DocBlock/Tags/Factory/ParamFactoryTest.php
@@ -25,6 +25,7 @@ use phpDocumentor\Reflection\Types\Context;
 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
 {
@@ -32,8 +33,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/Factory/TemplateCovariantFactoryTest.php b/tests/unit/DocBlock/Tags/Factory/TemplateCovariantFactoryTest.php
index 7dafd65..8150fde 100644
--- a/tests/unit/DocBlock/Tags/Factory/TemplateCovariantFactoryTest.php
+++ b/tests/unit/DocBlock/Tags/Factory/TemplateCovariantFactoryTest.php
@@ -20,6 +20,7 @@ use phpDocumentor\Reflection\Fqsen;
 use phpDocumentor\Reflection\Types\Context;
 use phpDocumentor\Reflection\Types\Object_;
 use phpDocumentor\Reflection\Types\String_;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 final class TemplateCovariantFactoryTest extends TagFactoryTestCase
 {
@@ -27,8 +28,8 @@ final class TemplateCovariantFactoryTest extends TagFactoryTestCase
      * @covers \phpDocumentor\Reflection\DocBlock\Tags\Factory\TemplateCovariantFactory::__construct
      * @covers \phpDocumentor\Reflection\DocBlock\Tags\Factory\TemplateCovariantFactory::create
      * @covers \phpDocumentor\Reflection\DocBlock\Tags\Factory\TemplateCovariantFactory::supports
-     * @dataProvider templateCovariantInputProvider
      */
+    #[DataProvider('templateCovariantInputProvider')]
     public function testTemplateCovariantIsCreated(string $input, Tag $expected): void
     {
         $ast = $this->parseTag($input);
diff --git a/tests/unit/DocBlock/Tags/Factory/TemplateFactoryTest.php b/tests/unit/DocBlock/Tags/Factory/TemplateFactoryTest.php
index 7b17fd3..e668be2 100644
--- a/tests/unit/DocBlock/Tags/Factory/TemplateFactoryTest.php
+++ b/tests/unit/DocBlock/Tags/Factory/TemplateFactoryTest.php
@@ -20,6 +20,7 @@ use phpDocumentor\Reflection\Fqsen;
 use phpDocumentor\Reflection\Types\Context;
 use phpDocumentor\Reflection\Types\Mixed_;
 use phpDocumentor\Reflection\Types\Object_;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 final class TemplateFactoryTest extends TagFactoryTestCase
 {
@@ -27,8 +28,8 @@ final class TemplateFactoryTest extends TagFactoryTestCase
      * @covers \phpDocumentor\Reflection\DocBlock\Tags\Factory\TemplateFactory::__construct
      * @covers \phpDocumentor\Reflection\DocBlock\Tags\Factory\TemplateFactory::create
      * @covers \phpDocumentor\Reflection\DocBlock\Tags\Factory\TemplateFactory::supports
-     * @dataProvider templateInputProvider
      */
+    #[DataProvider('templateInputProvider')]
     public function testTemplateIsCreated(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 b73adca..5863ce1 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/DocBlockFactoryTest.php b/tests/unit/DocBlockFactoryTest.php
index 0bb88b2..b4bea01 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());
