Skip to content

Conversation

@samsonasik
Copy link
Member

@samsonasik samsonasik commented Dec 17, 2021

Given the following code:

use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\UseAlias\TestOther as TestOtherAlias;
use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\UseAlias as TestFoo;

final class AliasUsed
{
    /**
    * @TestFoo\TestSmth
    */
    private string $foo;

    /**
    * @TestFoo\TestOther
    */
    private string $bar;

    /**
    * @TestOtherAlias
    */
    private string $baz;

}

It currently produce only 2 properties that updated:

-    /**
-    * @TestFoo\TestSmth
-    */
+    #[TestFoo\TestSmth]
     private string $foo;
 
-    /**
-    * @TestFoo\TestOther
-    */
+    #[TestFoo\TestOther]

The @TestOtherAlias should be updated as well to be:

+    #[TestOtherAlias]
     private string $baz;

This PR try to fixes rectorphp/rector#6867

@samsonasik
Copy link
Member Author

Fixed 🎉

@samsonasik
Copy link
Member Author

/cc @astronom

@samsonasik samsonasik merged commit db94f7a into main Dec 17, 2021
@samsonasik samsonasik deleted the handle-aliased-on-annotation-to-attribute branch December 17, 2021 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect behavior of AnnotationToAttributeRector

4 participants