Repository navigation
fix: stop AnnotationToAttributeRector depending on Rector's removed ArrayParser - #443
Merged
Merged
Conversation
…rrayParser rectorphp/rector-src#8881 removed StaticDoctrineAnnotationParser\ArrayParser, so the rule failed to construct on Rector dev-main. The GenericTagValueNode branch only produced a correct attribute for an argument-less tag; convert that to an attribute without arguments and leave other unparsed tags alone.
Collaborator
Author
|
@samsonasik it seems we might have a decent regression here because of rectorphp/rector-src#8881 since we cannot see data anymore? |
Contributor
|
can that be tweaked here? If yes, then I think tweak here is the way |
Collaborator
Author
|
Seems i overreacted, see related issue |
This was referenced Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
rectorphp/rector-src#8881 (merged 2026-10-29, not in a tagged release yet) removed
Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser\ArrayParser.AnnotationToAttributeRectortakes that class in its constructor, so on Rector dev-main the rule fails to load: 13 test errors (ReflectionException: Class "...ArrayParser" does not exist) and 3 PHPStanclass.notFounderrors.The next Rector release will most likely include both #8881 and rectorphp/rector-src#8897, which #441 waits on. This has to land before we raise the Rector requirement.
ArrayParserwas only used for tags Rector could not parse as a Doctrine annotation (GenericTagValueNode). That covers a bare@Action, arguments starting on the line after the tag, and@Actionfollowed by a description. Only the empty case produced a correct attribute; the others came out broken, e.g.Action('(id').The fix:
ArrayParserandTokenIteratorFactory.No existing fixture reached that branch. There are four new fixtures for the no-arguments and arguments-on-next-line cases, in both the default and next-major runs.
To Test
Tests and PHPStan pass on Rector 2.6.5, 2.8.3 and dev-main (
2a5280bf): 699 tests each, no baseline changes.Related: #441