-
Notifications
You must be signed in to change notification settings - Fork 48
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
Variable property access on SimpleXMLElement #243
Comments
Hi @ondrejmirtes, I'm interested in solving this issue. Option 1:
Option 2:
|
After some investigations, I think it will be option 2 because the rule previously handled the
It's confirmed by the test which passed SimpleXMLElement phpstan-strict-rules/tests/Rules/VariableVariables/VariablePropertyFetchRuleTest.php Line 18 in ed6fea0
It's confirmed by the doc https://phpstan.org/config-reference#universal-object-crates which said SImpleXMLElement is included by default Then, it was removed in this PHPStan commit phpstan/phpstan-src@56970a6 That's why SimpleXMLElement is not handled anymore |
I opened a PR to provide a behavior similar between SimpleXMLElement and Stdclass |
Bug report
I'm not sure if this is bug or intended behavior but since SimpleXMLElement has special treatment as an Universal object crates, this should be handled as well, as there is no other way to access nodes having hyphen or other prohibited character.
As per https://www.php.net/manual/en/simplexml.examples-basic.php, example 3
Code snippet that reproduces the problem
https://phpstan.org/r/93b6f5e2-cddb-4172-b42b-5017d0911fc4
Expected output
No error
Did PHPStan help you today? Did it make you happy in any way?
No response
The text was updated successfully, but these errors were encountered: