sebastianbergmann / phpunit

The PHP Unit Testing framework.

Home Page:https://phpunit.de/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Best practices/recommendations on how to move from docblock to native annotations

kkmuffme opened this issue · comments

https://phpunit.de/announcements/phpunit-11.html

In PHPUnit 11, the annotations that can be used in special PHP comments to add metadata to test classes and test methods are deprecated. Support for these annotations will be removed in PHPUnit 12.

We have 10000s of phpunit tests using the docblock annotation and I guess lots of companies have probably even more.

Will phpunit provide a tool itself, a recommendation for a tool or at least some recommendations/best practices from experience how other codebases have migrated from the old docblock syntax to the new syntax?

Manually changing them all isn't possible and writing our own custom tool would most certainly reinvent the wheel.

Will phpunit provide a tool itself

No, PHPUnit does not and will not provide such a tool.

a recommendation for a tool

I do not have first-hand experience, but I have heard from multiple developers/teams that they successfully used rector-phpunit for this.

Thanks, rector is what I had in mind already, I didn't know they have specific ones for phpunit already.

Maybe it makes sense to mention it in the release notes for 11 (and 12), as this is probably a common question.