File: 0005-Modernize-PHPUnit-syntax.patch

package info (click to toggle)
php-phpdocumentor-reflection-docblock 6.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 1,380 kB
  • sloc: php: 7,895; xml: 113; makefile: 57
file content (386 lines) | stat: -rw-r--r-- 16,026 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
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                |  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 ++-
 .../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, 35 insertions(+), 30 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 b903006..e99cae0 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;
 
 /**
@@ -451,9 +452,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);
@@ -521,9 +520,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 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());