rectorphp / rector-phpunit

Rector upgrade rules for PHPUnit
https://getrector.com/find-rule?activeRectorSetGroup=phpunit
MIT License
68 stars 47 forks source link

AnnotationWithValueToAttributeRector for @testWith annotation to (repeatable) #[TestWith] PHP 8 attribute #191

Closed kaczenski closed 1 year ago

kaczenski commented 1 year ago

Given the code:

    /**
     *
     * @testWith ["foo"]
     *           ["bar"]
     *           ["baz"]
     */
    public function testFoo(string $foo): void {}

Is currently refactored to:

    /**
     *
     *  #[TestWith('["Foo"]
     *       ["Bar"]
     *       ["Baz"]')]
     */
    public function testFoo(string $foo): void {}

Expected:

    /**
     *
     *  #[TestWith(['Foo'])
     *  #[TestWith(['Bar'])
     *  #[TestWith(['Baz'])
     */
    public function testFoo(string $foo): void {}
cf.
https://docs.phpunit.de/en/10.2/attributes.html#testwith
TomasVotruba commented 1 year ago

I'm looking into this...

TomasVotruba commented 1 year ago

Fixed in #209 :+1: