-
Notifications
You must be signed in to change notification settings - Fork 651
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
Psalm acts differently depending on what version of PHP it is executed on. #6305
Comments
I found these snippets: https://psalm.dev/r/a8f882ff61<?php
function bar(SimpleXMLElement $a): void {
foreach ($a->children() as $child) {
assert($child !== null);
}
}
|
Steps to reproduce:
|
Thanks for digging into this @greg0ire ! |
Under 8.0, |
It's unfortunate, we actually have a test case with a foreach loop over SimpleXmlElement::children, but it doesn't reproduce the issue... |
I think this may have to do with inheritance change in 8.0. In 8.0 |
Yep. Stubbing Context: https://externals.io/message/108789 and php/php-src#5234 Still not sure what would be the best way to address this. |
Shouldn't this be changed to Lines 96 to 97 in 4c26293
|
Historically, `SimpleXMLIterator` had only implemented `Iterator` and `RecursiveIterator` methods. This changed in 8.0, when iterator methods were moved to `SimpleXMLElement`, and `SimpleXMLIterator` was made a dummy class extending `SimpleXMLElement`. Fixes vimeo#6305, in the sense that Psalm would no longer report different errors depending on the runtime PHP version.
Context: I'm trying to fix an error that does not happen in the CI of doctrine/orm, but does happen on my machine where I use PHP 7.4.
I tried fixing it with an
assert
, but now I get the opposite situation: doctrine/orm#8917I cannot reproduce the issue on psalm.dev, that presumably does not run PHP 8
https://psalm.dev/r/a8f882ff61
On a machine with PHP 8, as well as on the CI, I know get this:
Either way, there is a difference in results depending on the version of PHP, and hardcoding
phpVersion
to7.1
in psalm.xml does not help. I'm not sure what to try next.See also: https://symfony-devs.slack.com/archives/C8SFXTD2M/p1628964600095200
The text was updated successfully, but these errors were encountered: