-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build an AST (Abstract syntax tree), before resolving classes and constants? #139
Comments
@donquixote seen #75? |
@Ocramius The discussion in #75 PR is so long :( I don't understand why #75 wants to change everything at once. Or to be more accurate: Libraries with annotated classes should not have to change anything. I think the annotations here are meant for libraries that define their own annotation classes, right? So changing this namespace would not affect the average annotated class. |
@Ocramius I started an 1.0 branch of https://github.com/donquixote/annotation-parser I think some of this can be useful for doctrine/annotation 2.x. There are still some aspects that I am not fully happy with. But I think some parts of the architecture are better than currently proposed in the PR. It uses a custom parser. But I think one could easily swap it for a hoa parser. The interesting part is ObjectResolverInterface. This interface is free of all the assumptions about annotation classes, imports and namespaces, and about the parser or AST. |
@donquixote If you're still interested in seeing AST in Annotations 2.0 and/or would like to discuss things, you can join us on Symfony Slack (get invitation here) - channel #doctrine-annotations2. We already have a grammar, AST and metadata concept, every input will be welcomed. :) |
Hi everyone, I've just noticed this issue. We needed something similar - to separate parsing and evaluating (e.g. of constants) in Rector - e.g. to rename any class name on any level without getting crazy. It run on The Doctrine annotation part is added here: It looks serious, but it's just dummy node traverser that translates doctrine-like simple tags to propper AST node :) There is a post that describes features and how it works together - From Doctrine Annotations Parser to Static Reflection |
Hello there,
every time I looked at the Doctrine annotation discovery (today, and many years ago), it made me wonder: How would I implement an annotation parser?
Currently,
\Doctrine\Common\Annotations\DocParser
does two things at once:This makes the component more complex than it needs to be.
Instead, this could be split up:
For absolutely no reason, I am posting a link to my own annotation parser, which follows this philosophy (but does not care about annotation classes).
https://github.com/donquixote/annotation-parser
This entire issue is "food for thought". I currently do not have a personal use case where I would absolutely need this change.
The text was updated successfully, but these errors were encountered: