php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80494 DOMElement::remove not documented
Submitted: 2020-12-08 11:19 UTC Modified: 2023-11-12 16:56 UTC
From: contact at perryrylance dot com Assigned: nielsdos (profile)
Status: Closed Package: DOM XML related
PHP Version: 8.0.0 OS: Windows 10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: contact at perryrylance dot com
New email:
PHP Version: OS:

 

 [2020-12-08 11:19 UTC] contact at perryrylance dot com
Description:
------------
I have a library which extends DOMElement.

My library adds DOMElement::remove for convenience.

After installing PHP 8 my library creates a fatal error.

The function definition I have for ExampleElement::remove does not match DOMElement::remove.

Not a biggie - I can simply change the function definition to match, *however*, the PHP manual does not document this function.

Test script:
---------------
<?php

class ExampleElement extends DOMElement
{
    public function remove()
    {
    }
}



Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-12-08 11:28 UTC] beberlei@php.net
Right, this was part of the DOM Living Standard RFC https://wiki.php.net/rfc/dom_living_standard_api

I haven't gotten around to the documentation part yet :-( The signature is without paraemters:

public function delete();
 [2020-12-08 11:28 UTC] beberlei@php.net
I am sorry, i meant:

public function remove();
 [2020-12-08 11:30 UTC] beberlei@php.net
Sorry, I am having a bad day, the problem is not the parameters, but that the PHP 8 api has "void" as return type, so my last attempt, this time its right :-)

public function remove(): void;

As a side-note, PHP 8 now contains so called stubs, that show the right signature directly in PHP code. See the DOM Extension and remove here: https://github.com/php/php-src/blob/master/ext/dom/php_dom.stub.php#L231
 [2020-12-08 11:43 UTC] contact at perryrylance dot com
Wonderful, thank you so much!

Looks like I can simply remove this from my implementation :)

Thanks again!
 [2021-05-11 06:11 UTC] contact at perryrylance dot com
Hi Benjamin

I see that more methods have been added to DOMElement, which is great.

I'd like to bring my library up to date, drop support for PHP < 7.0.0 and add return types and matching function signatures to your implementation.

I do have one request - could I perhaps ask that the functions remove, before, after and friends could possibly return $this?

My library facilitates method chaining, changing some of these functions to return void could break older projects.

If this is at all possible I'd massively appreciate it.

Thank you.
 [2021-11-09 12:05 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: Documentation problem +Package: DOM XML related
 [2021-11-09 12:05 UTC] cmb@php.net
> I do have one request - could I perhaps ask that the functions
> remove, before, after and friends could possibly return $this?

I think we should stick with the HTML standard, see
<https://dom.spec.whatwg.org/#interface-childnode>.
 [2023-11-12 16:56 UTC] nielsdos@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: nielsdos
 [2023-11-12 16:56 UTC] nielsdos@php.net
The fix for this bug has been committed.
If you are still experiencing this bug, try to check out latest source from https://github.com/php/php-src and re-test.
Thank you for the report, and for helping us make PHP better.

Documented now
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Sep 08 01:01:28 2024 UTC