psalm icon indicating copy to clipboard operation
psalm copied to clipboard

Add nikic/php-parser v5 support

Open VincentLanglet opened this issue 1 year ago • 6 comments

VincentLanglet avatar Jul 03 '24 09:07 VincentLanglet

I ran this over a code base that's still using php-parser 4. There's a problem with usePHPParserV4, which I've commented on, but with that fixed it seems to work.

Do we need to look at running tests against php-parser 4 as well?

Thanks. I added the CI "lowest" with php parser 4 and fixed the build.

VincentLanglet avatar Aug 10 '24 13:08 VincentLanglet

I think this i ready to be review @orklah @weirdan

VincentLanglet avatar Aug 10 '24 13:08 VincentLanglet

It would be really nice if we could merge this, currently it is not possible to install Psalm with PHPUnit 11 since it requires nikic/php-parser: ^5.0

chriskapp avatar Aug 20 '24 20:08 chriskapp

Friendly ping @weirdan if you have time to take a look (or can ping another maintainer ?). This PR would be really helpful, by allowing to use both Psalm and PHPunit 11.

VincentLanglet avatar Sep 08 '24 21:09 VincentLanglet

Yeah, it's on my todo list. The thing is big, so it'll take me some time.

weirdan avatar Sep 08 '24 21:09 weirdan

Since we expose parts of PhpParser in our API this cannot go into 5.x line. So instead of merging this I'm going to fork 6.x from the current 5.x (not master) and then use this PR as a base for PhpParser 5.x upgrade. 6.x will be a transitional, hopefully short-lived, series with the same platform requirements as 5.x.

Thanks for all your work, this will make it easier.

weirdan avatar Oct 12 '24 21:10 weirdan

If the branch-alias in the master branch is preventing you from using the 6.x branch (causing it to pull the master branch instead of referencing the correct commit from the 6.x branch), add #{commit_sha} to specify the correct branch.

For example:

"vimeo/psalm": "6.x-dev#0f796f1"

Replace 0f796f1 with the latest commit SHA for accurate results.

ghostwriter avatar Oct 27 '24 19:10 ghostwriter

Any update on this? I'm unable to install vimeo/psalm due to not support version 5 of nikic/php-parser.

bensinclair avatar Nov 07 '24 01:11 bensinclair

In addition to the dependency conflicts with various packages, nikic/php-parser 5 is required to parse new PHP 8.4 features: property hooks and asymmetric visibility.

PHP 8.4 releases in about a week. Currently Psalm is unable to parse these constructs, let alone type check them, so Psalm users will be blocked from adopting these new language features.

edsrzf avatar Nov 14 '24 20:11 edsrzf

In addition to the dependency conflicts with various packages, nikic/php-parser 5 is required to parse new PHP 8.4 features: property hooks and asymmetric visibility.

PHP 8.4 releases in about a week. Currently Psalm is unable to parse these constructs, let alone type check them, so Psalm users will be blocked from adopting these new language features.

It's this + that it's blocking anything else using nikic/php-parser 5 from being used with Psalm in the same package. PHPStan v2 and many more at this point.

WyriHaximus avatar Nov 15 '24 18:11 WyriHaximus

Any update on this? I'm unable to install vimeo/psalm due to not support version 5 of nikic/php-parser.

I installed phar with composer itself, but when I tried to install the laravel plugin, there was a conflict 🙃

amdlemos avatar Nov 23 '24 12:11 amdlemos

+1, would love to see this one working

mindriven avatar Dec 17 '24 10:12 mindriven

+1

felipefrancisco avatar Dec 17 '24 20:12 felipefrancisco

Please use directly dev-master until I tag a v6 (hopefully in January)

danog avatar Dec 25 '24 08:12 danog

JFYI: with property hooks (PHP 8.4) dev-master still not worked.

mrVrAlex avatar Jan 07 '25 17:01 mrVrAlex

Any ETA for this? Can't upgrade some dependencies because psalm depends on v4.

sabin-petru avatar Jan 23 '25 16:01 sabin-petru

Not merging this, please switch to dev-master/v6.

danog avatar Jan 23 '25 16:01 danog

For those following along, I've asked for an update on #11112.

fredden avatar Jan 23 '25 17:01 fredden