Merged
Conversation
|
When PHPStan is adding some stub for an SPL class, I also check Psalm stubs for compatibility. Psalm devs should do the same when they're adding SPL stubs as well. Since PHPStan was the first one with the stub, it's the Psalm one that should change to be compatible with PHPStan :) I'm not going to change the stub in PHPStan because it would be an unnecessary BC break for PHPStan's users. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR should fix the build.
The issue happened because in Psalm's last release, a stub for SplPriorityQueue was added in vimeo/psalm#4255.
Unfortunately, the order of the templates don't match with the existing one in PhpStan:
https://github.com/phpstan/phpstan-src/blob/6a38951c5cf040db5cae0e8e229064320a751413/stubs/spl.stub#L69
https://github.com/vimeo/psalm/blob/446a833d18419a5876ce5784ebe4309e33b89c64/stubs/CoreGenericClasses.phpstub#L1677
Furthermore, it seems phpstan doesn't read @phpstan-template-extends so I had to define the phpstan version as @template-extends and use @psalm-template-extends for the psalm version
@muglug @ondrejmirtes Maybe static analysis tools should have stubs in common, similar to the functions map to avoid this kind of issues?
@muglug For this case, the Psalm order seems more logical to me but the PhpStan one is older, meaning changing Psalm's one will break less things. Would you agree on a PR for this?