Skip to content

Fix DOMElement::getAttributeNode and DOMElement::getAttributeNodeNS#4484

Merged
ondrejmirtes merged 1 commit intophpstan:2.1.xfrom
VincentLanglet:domNode
Dec 6, 2025
Merged

Fix DOMElement::getAttributeNode and DOMElement::getAttributeNodeNS#4484
ondrejmirtes merged 1 commit intophpstan:2.1.xfrom
VincentLanglet:domNode

Conversation

@VincentLanglet
Copy link
Copy Markdown
Contributor

While looking at #3714
I discovered that getAttributeNode/getAttributeNodeNS return type was wrong

cf https://www.php.net/manual/en/domelement.getattributenode.php
and https://www.php.net/manual/en/domelement.getattributenodens.php

I fixed it in JetBrains/phpstorm-stubs#1811
but then we will end with false positive since PHPStan does not understand hasAttribute,
so I added a benevolent union.

I also added the non-regression from #3714 to show the related-issues are solved

Closes #3714

@ondrejmirtes ondrejmirtes merged commit cf57810 into phpstan:2.1.x Dec 6, 2025
636 checks passed
@ondrejmirtes
Copy link
Copy Markdown
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants