Revert #1741 - \DOMElement::$attributes is never null#1745
Revert #1741 - \DOMElement::$attributes is never null#1745isfedorov merged 2 commits intoJetBrains:masterfrom
Conversation
|
I agree with this PR @isfedorov, sorry my mistake |
|
I'm sorry but I'm not sure I've got it.
So as I understand this, this property can contain null if the object isn't a DOMElement. But even if the object is a DOMElement reflection still shows that the type of property is nullable. |
The logic behind is kinda Indeed seems like the reflection is telling the property might be nullable, but it's untrue for a
|
Readonly isn't related to nullability. If you assign a |
Sure But
This means that
|
|
How to help moving things @isfedorov @Jean85 ? I feel like the discussion is stucked |
|
@VincentLanglet I completely understand the reasoning of this change but what I don't like about this change is that we are trying to align stubs with actual runtime value instead of PHP native signature. What will happen if PHP implementation changes the default assigned value of property to |
|
Oh indeed. @Jean85 Can you change to ? |
See phpstan/phpstan#13076
This reverts #1741
From the PHP docs: https://www.php.net/manual/en/class.domnode.php#domnode.props.attributes
So, on
\DOMElementit's correct to override and mark it as not nullable.