phpunit-10-noteslisted
Install: claude install-skill hmj1026/dhpk
# PHPUnit 10 — attributes, PHP 8.1 floor, test runner rewrite
Released February 2023. **PHP 8.1+ floor** (not 8.0; this is a hard
install requirement). The big API shift is **PHP 8 attributes** for test
metadata.
> If you're on PHP 7.x or 8.0, PHPUnit 10 won't install. Stay on
> PHPUnit 9 until you can bump PHP. See the `phpunit-9-modern` skill
> for the latest version that works on 7.3+.
---
## Attribute-style annotations (the headline change)
Doc-comment annotations still work in 10 — but they're deprecated and
removed in 11. New tests should use attributes.
### Before (PHPUnit 9, still works in 10)
```php
/**
* @dataProvider priceCases
* @covers \App\Pricing\Calculator
* @group pricing
*/
public function testWithTax(int $cents, int $expected): void
{
self::assertSame($expected, (new Calculator)->withTax($cents));
}
```
### After (PHPUnit 10 preferred, mandatory in 11)
```php
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[CoversClass(\App\Pricing\Calculator::class)]
final class CalculatorTest extends TestCase
{
#[DataProvider('priceCases')]
#[Group('pricing')]
public function testWithTax(int $cents, int $expected): void
{
self::assertSame($expected, (new Calculator)->withTax($cents));
}
public static function priceCases(): \Generator
{
yield 'free' => [0, 0];
yield 'taxable' => [1000, 1100];
}
}
```
### Ful