[php-src] PR #11339: DOMNodeList::item may return DOMElement.
| From: | divinity76 | Date: | Mon, 29 May 2023 13:32:56 +0000 |
| Subject: | [php-src] PR #11339: DOMNodeList::item may return DOMElement. | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-22612@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/11339
Author: divinity76
Not explicitly documenting the possibility of returning DOMElement causes the Intelephense linter (a
popular PHP linter with ~9 million downloads: https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client
) to think this code is bad:
```php
$xp->query("whatever")->item(0)->getAttribute("foo");
```
because DOMNode does not have getAttribute (while DOMElement does). documenting the DOMElement
return type should fix Intelephense's linter.