-
-
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
php-parser v5 compat #8567
Comments
rector can't support php-parser v5 yet, as rector rely on phpstan that still uses php-parser v4 forcing it to support php-parser v5 will cause error:
see original effort for it: |
as long as rector cannot work with nikic/php-parser v5 I think it should declare a nikic/php-praser v4 dependency in its composer.json (or a v5 conflicts rule). that way composer will not install a incompatible v5 |
it seems |
hmm thinking again about it.. shouldn't the rector release have a prefixed version of nikic/php-parser?
the error message tells me that the rector release contains a unprefixed version? |
it exists in https://github.com/rectorphp/rector/tree/main/vendor/nikic/php-parser and preloaded
Looking at discussion at #8566 (reply in thread), the issue seems due to symfony DebugClassLoader |
we don't have the is there a reason php-parser is not prefixed within rector? |
if it prefixed, user can't create custom rector rule, as it always changed with |
I have a feeling that for some reason the preload.php of rector is included while phpunit is running. and the hardcoded require statements lead to a cannot redeclare error, because the php-parser classes are already loaded by the project dependencies |
maybe it would make sense to have something like
at the very beginning of different take at the problem: shouldn't the the |
Not sure, that need to be tested carefully first in Line 256 in 5ac9de7
iirc, without that, that was causing cross version that own phpstan inner phpdoc-parser replace it, make error without it. |
continue the discusson from rectorphp/rector-src#5742 (comment) ... a I think this won't work. another alternative: what about adding a https://getcomposer.org/doc/04-schema.md#replace I think the main question we need to ask ourselves: is the patched nikic/php-parser rector ships compatible with other tools out there which depend on nikic/php-parser |
Hi, just chiming in here. We're using a few packages (PHPUnit 11, Spatie typescript transformer) that rely on nikic/php-parser v5. All was fine until a few days ago where we started getting this error:
Took some digging to find the issue, but I just found out that Rector includes its own vendor dir with fixed package versions? 😨 The included nikic/php-parser is autoloaded before the one we have installed as part of Why does Rector include its own vendor dir instead of specifying the requirements in its own composer.json and relying on Composer to sort them out (including conflicts)? And in the mean time, how can we work around this besides |
See #8815 |
Bug Report
Minimal PHP Code Causing Issue
in a project which contains a dependency to nikic/parser, which leads to install parser v5, we run into a fatal error when in tandem rector is installed.
we see the following error when running a phpunit test-suite, while rector is installed as a dev dependency
IMO this is a conflict of the project level nikic/php-parser v5 and the in rector embedded nikic/php-parser v4.
Expected Behaviour
I think either the composer.json of rector/rector needs to declare a fixed dependency on nikic/php-parser v4
or rector needs to be compatible with nikic/php-parser v4 and v5 at the same time
The text was updated successfully, but these errors were encountered: