Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Valinor 1.14.2 breaks backwards compatibility with PHPStan 1.x as extension #588

Closed
NanoSector opened this issue Jan 13, 2025 · 6 comments · Fixed by #590
Closed

Valinor 1.14.2 breaks backwards compatibility with PHPStan 1.x as extension #588

NanoSector opened this issue Jan 13, 2025 · 6 comments · Fixed by #590

Comments

@NanoSector
Copy link
Contributor

Commit 9ef3cfb introduces an upgrade to PHPStan 2.x.

Because this targets dev dependencies, this seems like an innocent change isolated to this project, however this also means anything using the PHPStan extension alongside PHPStan 1.x will currently encounter crashes during analysis.

Specifically, the methods used to determine types differ between the two major versions, the case we are hitting is 9ef3cfb#diff-ea9b5457f00993b9839f70d8d1a8b84f01f6ec646dfc73329ca5951df29b241aR61

This method is in some cases called isClassStringType in PHPStan 1.x so an undefined method error is thrown. In other cases this value returns a boolean, so the yes() call also throws an undefined method error.

This probably should have been released in a minor version instead of a patch version as this currently is a backwards compatibility break.

@NanoSector NanoSector changed the title Valinor 1.14.2 breaks backwards compatibility with PHPStan 1.x Valinor 1.14.2 breaks backwards compatibility with PHPStan 1.x as extension Jan 13, 2025
@romm
Copy link
Member

romm commented Jan 13, 2025

Right, sorry for that! I'll take a look so that the PHPStan extension works with PHPStan v1 and v2.

Feel free to open a PR if you have time. 😊

@NanoSector
Copy link
Contributor Author

@eliashaeussler As you mention this is blocking for your project; for now you can make Composer ignore this update by specifying "^1.14,!=1.14.2" in your composer.json as version constraint.

@romm
Copy link
Member

romm commented Jan 14, 2025

Hi @NanoSector @eliashaeussler this should be fixed by #590. Before merging, could you try these changes on your codebase?

@eliashaeussler
Copy link

Hi @romm, as always – thank you very much for the very quick fix! Works on my end with PHPStan 1.12.15.

@NanoSector
Copy link
Contributor Author

@romm Thank you, that indeed does fix the issue, also with PHPStan 1.12.15! :)

@romm romm closed this as completed in #590 Jan 14, 2025
@romm
Copy link
Member

romm commented Jan 14, 2025

Thanks guys! Release coming up soon with this fix.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants