-
-
Notifications
You must be signed in to change notification settings - Fork 687
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
Refactor doctrine/annotation from dynamic to own static-reflection parser #5974
Conversation
10158de
to
3bd7d5c
Compare
c689ffa
to
e210efc
Compare
9028ddf
to
2886800
Compare
0d427a9
to
a830ec2
Compare
7034cb6
to
2ee8894
Compare
b748d51
to
faa82d0
Compare
faa82d0
to
c7f18ef
Compare
This is big jump for annotation format preserving #4334 Before, to parse class-based annotations the https://github.com/doctrine/annotations was needed: use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class Product
{
} That required the Further more, this approach required every such annotation to have own php doc node class and factory to make it. In total, Rector contained ~50 such classes + factories. The #5974 PR solves this using https://github.com/phpstan/phpdoc-parser and copying the doctrine/annotation behavior 1:1 without autoloading used classes and constants. Now, Rector is now using static for annotations making it more accessible to wide PHP comunity 🤗 👍 |
Closes #5454 |
rectorphp/rector-src@526a61b [Php83] Skip multiple consts on AddTypeToConstRector when types are different (#5974)
Follow up to making use of static reflection feature #5665
Now the Doctrine annotations need classes to be autoloaded, because they use https://github.com/doctrine/annotations
So now the real static reflection can be used only somewhere. That's source for these bugs #5517, #5628, #5725
This PR replaces doctrine/annotations package with custom parser that mimics its behavior, but uses phpstan/phpdoc-parser with static reflection 👍
That means, the doctrine annotation classes don't have to be autoloaded anymore. It also simplified the doc node printing with much less code.