-
Notifications
You must be signed in to change notification settings - Fork 132
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
Updated to nikic/PHP-Parser
4.x
#410
Conversation
29b9d86
to
8e1b674
Compare
Build is failing because PHPStan doesn't support PHP-Parser 4. @ondrejmirtes PHP-Parser 4 has been released 11 hours ago. What have you been doing the whole night? 😄 |
@kukulich @ondrejmirtes Have already create a issue there to track this migration 😂 |
Looks like my plans for Thursday have been sorted out for me 😂 |
@kukulich You could use the shim https://github.com/phpstan/phpstan-shim to focus on package upgrade at a time |
@TomasVotruba I tried, it doesnt work. |
That's how Rector can run on php-parser 4 and use phpstan with php-parser 3 at the same time:
What exactly did you try and what happened? |
PHP-Parser is not prefixed in the shim (because of extensions support) and
the two versions are incompatible.
On Sat, 3 Mar 2018 at 21:20, Tomáš Votruba ***@***.***> wrote:
It works for me:
- https://github.com/rectorphp/rector/blob/master/composer.json#L14
- https://github.com/rectorphp/rector/blob/master/composer.json#L26
What exactly did you tried and what happened?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#410 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGZuJo_zkcf7pcogM-k6nJXx7HqKMPBks5tavr_gaJpZM4SXfS9>
.
--
Ondřej Mirtes
|
Then |
You can also go with |
I don’t think that any of this would help - PHPStan uses PHP-Parser 3.x
which it has loaded into memory and when the analysis stumbles upon code
that uses 4.x, it will always crash.
On Sun, 4 Mar 2018 at 13:19, Théo FIDRY ***@***.***> wrote:
You can also go with barmani/composer-bin-plugin. Until a shim is
officially provided or a PHAR is used it's a good solution.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#410 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGZuO2LXC_FKVO28K_wvVx4EkywRIBZks5ta9vLgaJpZM4SXfS9>
.
--
Ondřej Mirtes
|
@kukulich what's the status of the PR? |
@theofidry The same. PHPStan doesn’t support PHP-Parser 4. The only solution is to disable phpstan check temporarily. |
Support in PHPStan is hopefully coming in June: i was relying on a
contributor to do the migration but he left the effort so I have to do it
myself.
On Tue, 8 May 2018 at 07:49, Jaroslav Hanslík ***@***.***> wrote:
@theofidry <https://github.com/theofidry> The same. PHPStan doesn’t
support PHP-Parser 4. The only solution is to disable phpstan check
temporarily.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#410 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGZuC3V7SRdSI4rTVXJjC4772RDUFh9ks5twTH_gaJpZM4SXfS9>
.
--
Ondřej Mirtes
|
Can't we disable PHPStan temporary then? It's a very nice to have tool but it doesn't feel like it should be a blocker neither and according to @ondrejmirtes it's gonna take another 1-2 months |
I'll prepare PR without PHPStan (already on my localhost) but I need to fix #422 first. |
Ready to review. I would like to have it in master so I can work again on #373 without future conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huge improvement! Just need one last bit around caching the expression evaluator
# env: DEPENDENCIES="" | ||
# before_script: | ||
# - travis_retry composer require --dev --prefer-dist --prefer-stable phpstan/phpstan:^0.9.2 | ||
# script: vendor/bin/phpstan analyse -l 5 -c phpstan.neon src |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it is impossible to analyse this codebase due to autoloading reflection?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly.
if ($node instanceof Node\Scalar\MagicConst\Class_) { | ||
return $this->compileClassConstant($context); | ||
} | ||
$constExprEvaluator = new ConstExprEvaluator(function (Node\Expr $node) use ($context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the evaluator instance be preserved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because it needs the fallback evaluator with the right context :( I tried to implemented it without the fallback evaluator and call other evaluations in catch
but it doesn't work. The test CompileNodeToValueTest::testClassConstantResolutionWithAnotherClassConstant
was failing because the test is combination of multiplication (supported by PHP-Parser itself) and class constants (supported by BR).
Thanks @kukulich! |
When can we expect a tag? It would help other packages to bump on php-parser 4.0 |
I was going to create a new tag, but I'll most likely first merge in #423 first |
Oh, that's great 👍 Sure! |
No description provided.