-
Notifications
You must be signed in to change notification settings - Fork 811
Revert #1741 - \DOMElement::$attributes is never null #1745
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
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
\DOMElement
it's correct to override and mark it as not nullable.