-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
phpstan/phpstan-src
#4196Labels
Milestone
Description
Bug report
We are having problems adding a string with an ampersand as a text element to a SimpleXMLElement node using addChild. Researching, I found https://stackoverflow.com/questions/2970575/php-simplexmlelement-set-text and applied its solution. It absolutely solves our problem. However, Phpstan complains "SimpleXMLElement does not accept string."
Code snippet that reproduces the problem
https://phpstan.org/r/79d3daf7-1686-4da3-abcd-b1329578af0c
Expected output
Phpstan should report no errors.
I believe Phpstan should not be reporting an error for assigning a string to element [0] of a simpleXMLElement. FWIW, https://onlinephp.io/c/d98a5 demonstrates that the code works correctly in all relevant Php versions.
Did PHPStan help you today? Did it make you happy in any way?
Yes, it helps. Thank you for producing and continuing to support it.
Reactions are currently unavailable