Skip to content

Commit 8a6d940

Browse files
minor #61299 replace PHPUnit annotations with attributes (xabbuh)
This PR was merged into the 7.4 branch. Discussion ---------- replace PHPUnit annotations with attributes | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT Commits ------- 982f89c61b9 replace PHPUnit annotations with attributes
2 parents 066b7ac + ebe0ab3 commit 8a6d940

29 files changed

+133
-264
lines changed

Test/VarDumperTestTrait.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\VarDumper\Test;
1313

14+
use PHPUnit\Framework\Attributes\After;
1415
use Symfony\Component\VarDumper\Cloner\VarCloner;
1516
use Symfony\Component\VarDumper\Dumper\CliDumper;
1617

@@ -36,9 +37,7 @@ protected function setUpVarDumper(array $casters, ?int $flags = null): void
3637
$this->varDumperConfig['flags'] = $flags;
3738
}
3839

39-
/**
40-
* @after
41-
*/
40+
#[After]
4241
protected function tearDownVarDumper(): void
4342
{
4443
$this->varDumperConfig['casters'] = [];

Tests/Caster/AddressInfoCasterTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111

1212
namespace Symfony\Component\VarDumper\Tests\Caster;
1313

14+
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
1617

17-
/**
18-
* @requires extension sockets
19-
*/
18+
#[RequiresPhpExtension('sockets')]
2019
class AddressInfoCasterTest extends TestCase
2120
{
2221
use VarDumperTestTrait;

Tests/Caster/CasterTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\VarDumper\Tests\Caster;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\VarDumper\Caster\Caster;
1617
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
@@ -32,9 +33,7 @@ class CasterTest extends TestCase
3233
"\0Foo\0private" => 'priv',
3334
];
3435

35-
/**
36-
* @dataProvider provideFilter
37-
*/
36+
#[DataProvider('provideFilter')]
3837
public function testFilter($filter, $expectedDiff, $listedProperties = null)
3938
{
4039
if (null === $listedProperties) {

Tests/Caster/CurlCasterTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111

1212
namespace Symfony\Component\VarDumper\Tests\Caster;
1313

14+
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
1617

17-
/**
18-
* @requires extension curl
19-
*/
18+
#[RequiresPhpExtension('curl')]
2019
class CurlCasterTest extends TestCase
2120
{
2221
use VarDumperTestTrait;

Tests/Caster/DOMCasterTest.php

Lines changed: 26 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\VarDumper\Tests\Caster;
1313

14+
use PHPUnit\Framework\Attributes\RequiresPhp;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
1617

@@ -32,9 +33,7 @@ public function testCastImplementation()
3233
);
3334
}
3435

35-
/**
36-
* @requires PHP 8.4
37-
*/
36+
#[RequiresPhp('8.4')]
3837
public function testCastModernImplementation()
3938
{
4039
$implementation = new \Dom\Implementation();
@@ -49,9 +48,7 @@ public function testCastModernImplementation()
4948
);
5049
}
5150

52-
/**
53-
* @requires PHP < 8.4
54-
*/
51+
#[RequiresPhp('<8.4')]
5552
public function testCastNodePriorToPhp84()
5653
{
5754
$doc = new \DOMDocument();
@@ -70,9 +67,7 @@ public function testCastNodePriorToPhp84()
7067
);
7168
}
7269

73-
/**
74-
* @requires PHP 8.4
75-
*/
70+
#[RequiresPhp('8.4')]
7671
public function testCastNode()
7772
{
7873
$doc = new \DOMDocument();
@@ -91,9 +86,7 @@ public function testCastNode()
9186
);
9287
}
9388

94-
/**
95-
* @requires PHP 8.4
96-
*/
89+
#[RequiresPhp('8.4')]
9790
public function testCastModernNode()
9891
{
9992
$doc = \Dom\XMLDocument::createFromString('<foo><bar/></foo>');
@@ -129,9 +122,7 @@ public function testCastDocument()
129122
);
130123
}
131124

132-
/**
133-
* @requires PHP 8.4
134-
*/
125+
#[RequiresPhp('8.4')]
135126
public function testCastXMLDocument()
136127
{
137128
$doc = \Dom\XMLDocument::createFromString('<foo><bar/></foo>');
@@ -150,9 +141,7 @@ public function testCastXMLDocument()
150141
);
151142
}
152143

153-
/**
154-
* @requires PHP 8.4
155-
*/
144+
#[RequiresPhp('8.4')]
156145
public function testCastHTMLDocument()
157146
{
158147
$doc = \Dom\HTMLDocument::createFromString('<!DOCTYPE html><html><body><p>foo</p></body></html>');
@@ -166,9 +155,7 @@ public function testCastHTMLDocument()
166155
);
167156
}
168157

169-
/**
170-
* @requires PHP < 8.4
171-
*/
158+
#[RequiresPhp('<8.4')]
172159
public function testCastTextPriorToPhp84()
173160
{
174161
$doc = new \DOMText('foo');
@@ -182,9 +169,7 @@ public function testCastTextPriorToPhp84()
182169
);
183170
}
184171

185-
/**
186-
* @requires PHP 8.4
187-
*/
172+
#[RequiresPhp('8.4')]
188173
public function testCastText()
189174
{
190175
$doc = new \DOMText('foo');
@@ -198,9 +183,7 @@ public function testCastText()
198183
);
199184
}
200185

201-
/**
202-
* @requires PHP 8.4
203-
*/
186+
#[RequiresPhp('8.4')]
204187
public function testCastModernText()
205188
{
206189
$text = \Dom\HTMLDocument::createEmpty()->createTextNode('foo');
@@ -213,9 +196,7 @@ public function testCastModernText()
213196
);
214197
}
215198

216-
/**
217-
* @requires PHP < 8.4
218-
*/
199+
#[RequiresPhp('<8.4')]
219200
public function testCastAttrPriorToPhp84()
220201
{
221202
$attr = new \DOMAttr('attr', 'value');
@@ -233,9 +214,7 @@ public function testCastAttrPriorToPhp84()
233214
);
234215
}
235216

236-
/**
237-
* @requires PHP 8.4
238-
*/
217+
#[RequiresPhp('8.4')]
239218
public function testCastAttr()
240219
{
241220
$attr = new \DOMAttr('attr', 'value');
@@ -253,9 +232,7 @@ public function testCastAttr()
253232
);
254233
}
255234

256-
/**
257-
* @requires PHP 8.4
258-
*/
235+
#[RequiresPhp('8.4')]
259236
public function testCastAttrPrior()
260237
{
261238
$attr = new \DOMAttr('attr', 'value');
@@ -273,9 +250,7 @@ public function testCastAttrPrior()
273250
);
274251
}
275252

276-
/**
277-
* @requires PHP 8.4
278-
*/
253+
#[RequiresPhp('8.4')]
279254
public function testCastModernAttr()
280255
{
281256
$attr = \Dom\HTMLDocument::createEmpty()->createAttribute('attr');
@@ -292,9 +267,7 @@ public function testCastModernAttr()
292267
);
293268
}
294269

295-
/**
296-
* @requires PHP < 8.4
297-
*/
270+
#[RequiresPhp('<8.4')]
298271
public function testCastElementPriorToPhp84()
299272
{
300273
$attr = new \DOMElement('foo');
@@ -308,9 +281,7 @@ public function testCastElementPriorToPhp84()
308281
);
309282
}
310283

311-
/**
312-
* @requires PHP 8.4
313-
*/
284+
#[RequiresPhp('8.4')]
314285
public function testCastElement()
315286
{
316287
$attr = new \DOMElement('foo');
@@ -324,9 +295,7 @@ public function testCastElement()
324295
);
325296
}
326297

327-
/**
328-
* @requires PHP 8.4
329-
*/
298+
#[RequiresPhp('8.4')]
330299
public function testCastModernElement()
331300
{
332301
$attr = \Dom\HTMLDocument::createEmpty()->createElement('foo');
@@ -340,9 +309,7 @@ public function testCastModernElement()
340309
);
341310
}
342311

343-
/**
344-
* @requires PHP < 8.4
345-
*/
312+
#[RequiresPhp('<8.4')]
346313
public function testCastDocumentTypePriorToPhp84()
347314
{
348315
$implementation = new \DOMImplementation();
@@ -362,9 +329,7 @@ public function testCastDocumentTypePriorToPhp84()
362329
);
363330
}
364331

365-
/**
366-
* @requires PHP 8.4
367-
*/
332+
#[RequiresPhp('8.4')]
368333
public function testCastDocumentType()
369334
{
370335
$implementation = new \DOMImplementation();
@@ -384,9 +349,7 @@ public function testCastDocumentType()
384349
);
385350
}
386351

387-
/**
388-
* @requires PHP 8.4
389-
*/
352+
#[RequiresPhp('8.4')]
390353
public function testCastModernDocumentType()
391354
{
392355
$implementation = new \Dom\Implementation();
@@ -406,9 +369,7 @@ public function testCastModernDocumentType()
406369
);
407370
}
408371

409-
/**
410-
* @requires PHP < 8.4
411-
*/
372+
#[RequiresPhp('<8.4')]
412373
public function testCastProcessingInstructionPriorToPhp84()
413374
{
414375
$entity = new \DOMProcessingInstruction('target', 'data');
@@ -423,9 +384,7 @@ public function testCastProcessingInstructionPriorToPhp84()
423384
);
424385
}
425386

426-
/**
427-
* @requires PHP 8.4
428-
*/
387+
#[RequiresPhp('8.4')]
429388
public function testCastProcessingInstruction()
430389
{
431390
$entity = new \DOMProcessingInstruction('target', 'data');
@@ -440,9 +399,7 @@ public function testCastProcessingInstruction()
440399
);
441400
}
442401

443-
/**
444-
* @requires PHP 8.4
445-
*/
402+
#[RequiresPhp('8.4')]
446403
public function testCastModernProcessingInstruction()
447404
{
448405
$entity = \Dom\HTMLDocument::createEmpty()->createProcessingInstruction('target', 'data');
@@ -458,9 +415,7 @@ public function testCastModernProcessingInstruction()
458415
);
459416
}
460417

461-
/**
462-
* @requires PHP < 8.4
463-
*/
418+
#[RequiresPhp('<8.4')]
464419
public function testCastXPathPriorToPhp84()
465420
{
466421
$xpath = new \DOMXPath(new \DOMDocument());
@@ -475,9 +430,7 @@ public function testCastXPathPriorToPhp84()
475430
);
476431
}
477432

478-
/**
479-
* @requires PHP 8.4
480-
*/
433+
#[RequiresPhp('8.4')]
481434
public function testCastXPath()
482435
{
483436
$xpath = new \DOMXPath(new \DOMDocument());
@@ -492,9 +445,7 @@ public function testCastXPath()
492445
);
493446
}
494447

495-
/**
496-
* @requires PHP 8.4
497-
*/
448+
#[RequiresPhp('8.4')]
498449
public function testCastModernXPath()
499450
{
500451
$entity = new \Dom\XPath(\Dom\HTMLDocument::createEmpty());

0 commit comments

Comments
 (0)