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
Argument 1 of SimpleXMLElement::attributes cannot be null - Irreproduceable in sandbox #8603
Comments
Hey @jnvsor, can you reproduce the issue on https://psalm.dev ? |
Are you running the latest version of dev-master? You can use |
Version says Thanks for the info on psalm-trace, but it's made things even more confusing:
So it correctly identifies Lots of contradictions in there |
I'm getting an error in real code that I can't reproduce in the sandbox:
In the sandbox I pass in null and it works just fine, and the sandbox and my local psalm are on the same commit...
On top of that:
So I have no idea what the cause could be.
I assume there's some strange edge case in my code causing this error, but since
SimpleXMLElement::attributes
absolutely can take null on the first argument, the error still seems wrong.The line in question:
https://github.com/jnvsor/kint/blob/5bf5527e2b51ff3edfe438c46216d18be3fab1a4/src/Parser/SimpleXMLElementPlugin.php#L99
The closest potential hint is that psalm (and the PHP docs) incorrectly say the result of
SimpleXMLElement::getDocNamespaces
isarray|false
(Probably because libxml2'sxmlDocGetRootElement
can return null?) but according to https://3v4l.org/Qenk7 there's no version where false is returned. Maybe there is an edge case but I can't think of one.Anyway, even with that hint it would be complaining about false, not null, since null is a valid input.
So I'm stumped. Any ideas?
Is there a verbose debug mode or some annotation that makes psalm print its types at that point of execution I could use to debug this further?
The text was updated successfully, but these errors were encountered: