Conversation
|
If you run the RenameClassRector before the rule, it's broken. If you run it after the rule, it works so there must be something going on with the doc block in RenameClassRector that breaks. |
|
I tried this locally, and this is expected :), when you are inner namespace without namespace Rector\Tests\Issues\Issue9388\Fixture;
/** @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty") */The type detected is namespace + value of @, so it become a non-existing object type: Rector\Tests\Issues\Issue9388\Fixture\TYPO3\CMS\Extbase\Annotation\Validate;If you want to apply it, ensure the use TYPO;so it will correctly detect it :) |
| if (str_starts_with($doctrineTagValueNode->identifierTypeNode->name, '@TYPO3\CMS')) { | ||
| $doctrineTagValueNode->identifierTypeNode->name = str_replace( | ||
| '@TYPO3\CMS', | ||
| '@\\TYPO3\CMS', | ||
| $doctrineTagValueNode->identifierTypeNode->name | ||
| ); | ||
| } |
There was a problem hiding this comment.
This is why when you flip the rule, the rule is "working", while actually invalid, as the original namespaced name is current namespace + value identifier if no \\ prefix, so you're changing behaviour of valid identifier.
Add use TYPO, and you will have correct detection :)
See rectorphp/rector/issues/9388