Repository navigation
[7.3] PHPUnit migration from annotation to attributes #386
llaville
started this conversation in
Show and tell
Replies: 1 comment
|
Metadata migration (with Rector) gave us following results with commit 79a1bfb |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
On the roadmap to the new version 7.3.0 :
The major change that required our attention is the metatada in PHPUnit 11.
We have now to migrate from PHP doc-comment annotations to PHP 8 attributes to be sure to make our Unit Tests Suites compatible with PHPUnit 11, 12 and 13.
With Rector
To apply changes on all
testsdirectory source code, we will use Rector, with following custom configuration:rector-phpunit.phpAnd to check what code refactoring will be done, we can use following command :
And then do the Job with following command :
With PHP-CS-Fixer (alternative)
Alternative way will be to use PHP-CS-Fixer with such following configuration
.php-cs-fixer.phpfile contents :Checking with command :
That gave us such results :
And apply modifications with command :
But I prefer Rector way that make import FQCN uses very easy compared to CS-Fixer : learn more with PHP-CS-Fixer/PHP-CS-Fixer#6966
All reactions