-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
PHP7 return types incompatibile with generate code #6106
Comments
It seems the version of We decided to temporarily patch this and bring in some Note that you will need to put it in your own module and rename the namespaces. |
As the scanner code in the |
M2 took "ownership" of ZF code, but I agree that the package should be replaced. But that's even more refactoring. |
internal issue MAGETWO-59661 |
@tkacheva any updates on this issue ? |
Interesting case :) Never thought of writing PHP5-incompatible code within Magento 2.
https://github.com/zendframework/zend-code/blob/release-3.1.0/composer.json#L17 which dependencies?
Why another library if it is BC break anyway? Why not simply stick to At first glance https://github.com/zendframework/zend-code/blob/master/doc/book/migration.md does not seem to be really painful.
And this sentence looks exactly like the our case: we can use fancy new PHP7 features while all generated code will remain PHP5-compatible. |
Because |
@mwgamble aren't they supported since version |
@orlangur nope. see here: zendframework/zend-code#56 Also see the responses to my comments here: zendframework/zend-code#87 (comment) |
@mwgamble, thanks for the details, I'll look closer into it. If scanner will not be adopted in So, it's better switch to |
@orlangur with
On latest |
@AydinHassan, yeah, I tried it as well, And as it requires These changes does not seem to be painful. |
@orlangur I'm not sure that means it's unstable - it's tagged as a stable release and uses stable dependencies. If you look at the blame for those lines - it's from 2+ years ago. In any case Composer only uses that info from the root package - It looks like that could have been added for local development of the package. Regarding the |
Minimal set of changes to pull in
Maybe we don't need to take all of the deps to the latest |
Thanks! I was bored and did not come to an installable set of packages.
Unavoidable? https://github.com/zendframework/zend-stdlib/blob/master/doc/book/migration.md |
Seems it is avoidable:
|
That sounds way better) Thanks for your efforts. |
I highly recommend Nikita Popov's PHP Parser library: https://github.com/nikic/PHP-Parser It has full support for everything Magento 2 needs, and is actively maintained by one of the core developers of the PHP language itself. |
Yeah, I really enjoyed using it for various code analysis, there is no surprise You think it is an overkill and it's better to have own simple implementation on top of |
Issue in progress @epson121 |
… still not supported by magento magento/magento2#6106
… code #6106 - Updated Zend Code library to 3.x version and it dependencies - Refactored code generators to support PHP 7.x features - Refactored Setup module for new Zend Service Manager - Covered code generators by tests
… code #6106 - Updated reference blacklist - Added method description for event listener
… code #6106 - Reverted blacklist changes
… code #6106 - Resolved composer conflicts
… code #6106 - Resolved merge conflicts
The fix merged into develop branch. |
@joni-jones any chance 7.1 support will be backported to 2.1? |
Hi, @craigcarnell, unfortunately, I can't provide any information about backporting this functionality to 2.1.x version. At this moment this functionality will be only in 2.2. |
I use Magento v2.3.2
It looks like the same problem but with loggers generation in this time. |
the same problem as above |
Magento 2.3.3
As soon as SetEnv MAGE_PROFILER 2 is enabled in .htaccess. |
Preconditions
Steps to reproduce
: string
Expected result
Actual result
Instead you get a fatal error from PHP because the generated interceptor class doesn't have a return type at all.
This of course can be a tricky one to resolve purely based on the fact you wouldn't want to break BC with PHP 5.X.
The only resolutions I can think of at this point is...
The text was updated successfully, but these errors were encountered: