Bug #80537 [Asn->Csd]: Wrong parameter type in DOMElement::removeAttributeNode stub

From: Date: Mon, 21 Dec 2020 09:23:54 +0000
Subject: Bug #80537 [Asn->Csd]: Wrong parameter type in DOMElement::removeAttributeNode stub
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231203@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80537&edit=1 ID: 80537 Updated by: nikic@php.net Reported by: ondrej at mirtes dot cz Summary: Wrong parameter type in DOMElement::removeAttributeNode stub -Status: Assigned +Status: Closed Type: Bug Package: Reflection related Operating System: N/A PHP Version: 8.0.0 Assigned To: nikic Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikita.ppv@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=27e250880b46031755a6985c340a6fb2186b9271 Log: Fix bug #80537 Previous Comments: ------------------------------------------------------------------------ [2020-12-21 08:48:40] ondrej at mirtes dot cz Description: ------------ The stub for this method looks like this (https://github.com/php/php-src/blob/4c5e47d113429773a885e78599e20cfe0490905b/ext/dom/php_dom.stub.php#L207-L208): /** @return DOMAttr|false */ public function removeAttributeNode(string $qualifiedName) {} But the method accepts DOMAttr: https://3v4l.org/dbST3 PHP documentation agrees: https://www.php.net/manual/en/domelement.removeattributenode.php Originally reported as PHPStan bug: https://github.com/phpstan/phpstan/issues/4268 Test script: --------------- <?php declare(strict_types = 1); $document = new DOMDocument(); $document->loadXML('<x a="foo"/>'); /** @var DOMElement $element */ $element = $document->documentElement; $attribute = $element->getAttributeNode('a'); $element->removeAttributeNode($attribute); var_dump($document->saveHTML()); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80537&edit=1

« previous php.bugs (#231203) next »