-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Migarting from version 3 to version 4 breaks making changes to existing classes using reflection #94
Comments
There also used to be a whole bunch of Scanners... I just tried to find the CachingFileScanner to feed the right data into FileGenerator and work around the issue. That Scanner along with most of the rest also seems to be purged out of existence. |
Cool stuff... No changelog.. but digging into the commits I found this pull request: |
… On Mon, 12 Jul 2021, 12:10 Ivan Ganev, ***@***.***> wrote:
Closed #94 <#94>.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#94 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABFVEA2DVOXSAQQCNH6QPDTXK5P5ANCNFSM5AGPTVXQ>
.
|
Not soon enough. But eventually did. The so-called "better alternative" requires PHP >= 7.4.1 && < 7.5. So 8 is out of the question. |
Yes, I and @asgrim try to do what we can during our free time: you can try and help on Roave/BetterReflection#701 if you have an active need, and you or your employer want to chip in. Meanwhile, the scanner component was in shambles with PHP 8 anyway, and maintaining it further was out of question. |
BC Break Report
Summary
Migrating from 3.5.1 to 4.4.2 seems impossible. Generation based on reflection is fundamentally broken.
Previous behavior
There used to be a FileReflection class in the Reflection namespace. This class no longer exists. This breaks generating classes based on existing code. FileReflection used to hold the namespace, uses and a bunch of other misc stuff. Now IN THEORY these are held in the ClassReflection, however, uses are not being parsed at all. Loading a class reflection into a class generator and then generating the code results in ALL uses getting stripped out, rendering the class source code invalid.
Current behavior
Judging by the documented examples and by reading the code, currently to perform code generation on existing classes I must use the ClassReflection object as a consutrctor parameter to the ClassGenerator class. This however fails to parse the use statements OUTSIDE the class and they get permanently lost. This makes generation based on existing code impossible to work in real-world cases. Reading the code of the ClassGenerator I see that both traits and uses are being bundled together... this sounds like no external uses are supported at all...
How to reproduce
The text was updated successfully, but these errors were encountered: