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
Dynamic properties of SimpleXMLElement should be inferred as being SimpleXMLElement #9997
Comments
I found these snippets: https://psalm.dev/r/100575e0f4<?php
$string = <<<XML
<a>
<foo name="one" game="lonely">1</foo>
</a>
XML;
$xml = new SimpleXMLElement($string);
foreach($xml->foo[0]->attributes() as $a => $b) {
echo $a,'="',$b,"\"\n";
}
|
Based on the discussion in phpstan/phpstan#9575, it should be inferred as |
stof
changed the title
Dynamic properties of SimpleXMLElement should be infered as being SimpleXMLElement
Dynamic properties of SimpleXMLElement should be inferred as being SimpleXMLElement
Jul 5, 2023
ygottschalk
added a commit
to ygottschalk/psalm
that referenced
this issue
Jul 25, 2023
- make SimpleXmlElement and SimpleXmlIterator not a universal object crate - added typed magic __get method to SimpleXmlElement - 'fixed' code translating `null` to `TNamedObject('null')` instead of `TNull`
ygottschalk
added a commit
to ygottschalk/psalm
that referenced
this issue
Jul 25, 2023
- make SimpleXmlElement and SimpleXmlIterator not a universal object crate - added typed magic __get method to SimpleXmlElement - 'fixed' code translating `null` to `TNamedObject('null')` instead of `TNull`
ygottschalk
added a commit
to ygottschalk/psalm
that referenced
this issue
Jul 25, 2023
- make SimpleXmlElement and SimpleXmlIterator not a universal object crate - added typed magic __get method to SimpleXmlElement - adjusted tests to reflect new behaviour of SimpleXmlElement - added tests - 'fixed' code translating `null` to `TNamedObject('null')` instead of `TNull`
ygottschalk
added a commit
to ygottschalk/psalm
that referenced
this issue
Jul 25, 2023
- make SimpleXmlElement and SimpleXmlIterator not a universal object crate - added typed magic __get method to SimpleXmlElement - adjusted tests to reflect new behaviour of SimpleXmlElement - added tests - 'fixed' code translating `null` to `TNamedObject('null')` instead of `TNull`
ygottschalk
added a commit
to ygottschalk/psalm
that referenced
this issue
Aug 5, 2023
- make SimpleXmlElement and SimpleXmlIterator not a universal object crate - added typed magic __get method to SimpleXmlElement - adjusted tests to reflect new behaviour of SimpleXmlElement - added tests
ygottschalk
added a commit
to ygottschalk/psalm
that referenced
this issue
Aug 5, 2023
- make SimpleXmlElement and SimpleXmlIterator not a universal object crate - added typed magic __get method to SimpleXmlElement - adjusted tests to reflect new behaviour of SimpleXmlElement - added tests
orklah
added a commit
that referenced
this issue
Aug 5, 2023
…dynamic-properties Fix #9997 dynamic properties on SimpleXmlElement
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://psalm.dev/r/100575e0f4
This reports mixed errors saying it cannot infer the type of expressions. But dynamic properties of SimpleXMLElement are always SimpleXMLElement themselves.
The text was updated successfully, but these errors were encountered: