diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c index dda7a42a129..36298f52683 100644 --- a/ext/dom/characterdata.c +++ b/ext/dom/characterdata.c @@ -325,63 +325,4 @@ PHP_METHOD(DOMCharacterData, replaceData) } /* }}} end dom_characterdata_replace_data */ -PHP_METHOD(DOMCharacterData, remove) -{ - dom_object *intern; - - if (zend_parse_parameters_none() == FAILURE) { - RETURN_THROWS(); - } - - DOM_GET_THIS_INTERN(intern); - - dom_child_node_remove(intern); - RETURN_NULL(); -} - -PHP_METHOD(DOMCharacterData, after) -{ - uint32_t argc = 0; - zval *args; - dom_object *intern; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &args, &argc) == FAILURE) { - RETURN_THROWS(); - } - - DOM_GET_THIS_INTERN(intern); - - dom_parent_node_after(intern, args, argc); -} - -PHP_METHOD(DOMCharacterData, before) -{ - uint32_t argc = 0; - zval *args; - dom_object *intern; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &args, &argc) == FAILURE) { - RETURN_THROWS(); - } - - DOM_GET_THIS_INTERN(intern); - - dom_parent_node_before(intern, args, argc); -} - -PHP_METHOD(DOMCharacterData, replaceWith) -{ - uint32_t argc = 0; - zval *args; - dom_object *intern; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &args, &argc) == FAILURE) { - RETURN_THROWS(); - } - - DOM_GET_THIS_INTERN(intern); - - dom_child_replace_with(intern, args, argc); -} - #endif diff --git a/ext/dom/document.c b/ext/dom/document.c index 7d9ec93169a..a760e3a425b 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -2082,44 +2082,6 @@ PHP_METHOD(DOMDocument, registerNodeClass) } /* }}} */ -/* {{{ URL: https://dom.spec.whatwg.org/#dom-parentnode-append -Since: DOM Living Standard (DOM4) -*/ -PHP_METHOD(DOMDocument, append) -{ - uint32_t argc = 0; - zval *args; - dom_object *intern; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &args, &argc) == FAILURE) { - RETURN_THROWS(); - } - - DOM_GET_THIS_INTERN(intern); - - dom_parent_node_append(intern, args, argc); -} -/* }}} */ - -/* {{{ URL: https://dom.spec.whatwg.org/#dom-parentnode-prepend -Since: DOM Living Standard (DOM4) -*/ -PHP_METHOD(DOMDocument, prepend) -{ - uint32_t argc = 0; - zval *args; - dom_object *intern; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &args, &argc) == FAILURE) { - RETURN_THROWS(); - } - - DOM_GET_THIS_INTERN(intern); - - dom_parent_node_prepend(intern, args, argc); -} -/* }}} */ - /* {{{ URL: https://dom.spec.whatwg.org/#dom-parentnode-replacechildren Since: */ diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c index 33268091720..e3d9db72381 100644 --- a/ext/dom/documentfragment.c +++ b/ext/dom/documentfragment.c @@ -93,61 +93,4 @@ PHP_METHOD(DOMDocumentFragment, appendXML) { } /* }}} */ -/* {{{ URL: https://dom.spec.whatwg.org/#dom-parentnode-append -Since: DOM Living Standard (DOM4) -*/ -PHP_METHOD(DOMDocumentFragment, append) -{ - uint32_t argc = 0; - zval *args; - dom_object *intern; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &args, &argc) == FAILURE) { - RETURN_THROWS(); - } - - DOM_GET_THIS_INTERN(intern); - - dom_parent_node_append(intern, args, argc); -} -/* }}} */ - -/* {{{ URL: https://dom.spec.whatwg.org/#dom-parentnode-prepend -Since: DOM Living Standard (DOM4) -*/ -PHP_METHOD(DOMDocumentFragment, prepend) -{ - uint32_t argc = 0; - zval *args; - dom_object *intern; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &args, &argc) == FAILURE) { - RETURN_THROWS(); - } - - DOM_GET_THIS_INTERN(intern); - - dom_parent_node_prepend(intern, args, argc); -} -/* }}} */ - -/* {{{ URL: https://dom.spec.whatwg.org/#dom-parentnode-replacechildren -Since: -*/ -PHP_METHOD(DOMDocumentFragment, replaceChildren) -{ - uint32_t argc = 0; - zval *args; - dom_object *intern; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &args, &argc) == FAILURE) { - RETURN_THROWS(); - } - - DOM_GET_THIS_INTERN(intern); - - dom_parent_node_replace_children(intern, args, argc); -} -/* }}} */ - #endif diff --git a/ext/dom/php_dom.stub.php b/ext/dom/php_dom.stub.php index bc1033b29df..fb8faaab10f 100644 --- a/ext/dom/php_dom.stub.php +++ b/ext/dom/php_dom.stub.php @@ -480,13 +480,22 @@ class DOMDocumentFragment extends DOMNode implements DOMParentNode /** @tentative-return-type */ public function appendXML(string $data): bool {} - /** @param DOMNode|string $nodes */ + /** + * @param DOMNode|string $nodes + * @implementation-alias DOMElement::append + */ public function append(...$nodes): void {} - /** @param DOMNode|string $nodes */ + /** + * @param DOMNode|string $nodes + * @implementation-alias DOMElement::prepend + */ public function prepend(...$nodes): void {} - /** @param DOMNode|string $nodes */ + /** + * @param DOMNode|string $nodes + * @implementation-alias DOMDocument::replaceChildren + */ public function replaceChildren(...$nodes): void {} } @@ -532,15 +541,25 @@ class DOMCharacterData extends DOMNode implements DOMChildNode /** @tentative-return-type */ public function replaceData(int $offset, int $count, string $data): bool {} - /** @param DOMNode|string $nodes */ + /** + * @param DOMNode|string $nodes + * @implementation-alias DOMElement::replaceWith + */ public function replaceWith(...$nodes): void {} + /** @implementation-alias DOMElement::remove */ public function remove(): void {} - /** @param DOMNode|string $nodes */ + /** + * @param DOMNode|string $nodes + * @implementation-alias DOMElement::before + */ public function before(... $nodes): void {} - /** @param DOMNode|string $nodes */ + /** + * @param DOMNode|string $nodes + * @implementation-alias DOMElement::after + */ public function after(...$nodes): void {} } @@ -838,10 +857,16 @@ class DOMDocument extends DOMNode implements DOMParentNode /** @tentative-return-type */ public function adoptNode(DOMNode $node): DOMNode|false {} - /** @param DOMNode|string $nodes */ + /** + * @param DOMNode|string $nodes + * @implementation-alias DOMElement::append + */ public function append(...$nodes): void {} - /** @param DOMNode|string $nodes */ + /** + * @param DOMNode|string $nodes + * @implementation-alias DOMElement::prepend + */ public function prepend(...$nodes): void {} /** @param DOMNode|string $nodes */ diff --git a/ext/dom/php_dom_arginfo.h b/ext/dom/php_dom_arginfo.h index 1b7fc063fa2..9ed5aa443cb 100644 --- a/ext/dom/php_dom_arginfo.h +++ b/ext/dom/php_dom_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 4705229124ee243538e712f4af1d94ddc4c3be0b */ + * Stub hash: 9142d10743d4ec2f5e587c67bd111155c6149efd */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_dom_import_simplexml, 0, 1, DOMElement, 0) ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0) @@ -564,9 +564,9 @@ ZEND_METHOD(DOMImplementation, createDocumentType); ZEND_METHOD(DOMImplementation, createDocument); ZEND_METHOD(DOMDocumentFragment, __construct); ZEND_METHOD(DOMDocumentFragment, appendXML); -ZEND_METHOD(DOMDocumentFragment, append); -ZEND_METHOD(DOMDocumentFragment, prepend); -ZEND_METHOD(DOMDocumentFragment, replaceChildren); +ZEND_METHOD(DOMElement, append); +ZEND_METHOD(DOMElement, prepend); +ZEND_METHOD(DOMDocument, replaceChildren); ZEND_METHOD(DOMNodeList, count); ZEND_METHOD(DOMNodeList, getIterator); ZEND_METHOD(DOMNodeList, item); @@ -575,10 +575,10 @@ ZEND_METHOD(DOMCharacterData, substringData); ZEND_METHOD(DOMCharacterData, insertData); ZEND_METHOD(DOMCharacterData, deleteData); ZEND_METHOD(DOMCharacterData, replaceData); -ZEND_METHOD(DOMCharacterData, replaceWith); -ZEND_METHOD(DOMCharacterData, remove); -ZEND_METHOD(DOMCharacterData, before); -ZEND_METHOD(DOMCharacterData, after); +ZEND_METHOD(DOMElement, replaceWith); +ZEND_METHOD(DOMElement, remove); +ZEND_METHOD(DOMElement, before); +ZEND_METHOD(DOMElement, after); ZEND_METHOD(DOMAttr, __construct); ZEND_METHOD(DOMAttr, isId); ZEND_METHOD(DOMElement, __construct); @@ -602,12 +602,6 @@ ZEND_METHOD(DOMElement, setIdAttribute); ZEND_METHOD(DOMElement, setIdAttributeNS); ZEND_METHOD(DOMElement, setIdAttributeNode); ZEND_METHOD(DOMElement, toggleAttribute); -ZEND_METHOD(DOMElement, remove); -ZEND_METHOD(DOMElement, before); -ZEND_METHOD(DOMElement, after); -ZEND_METHOD(DOMElement, replaceWith); -ZEND_METHOD(DOMElement, append); -ZEND_METHOD(DOMElement, prepend); ZEND_METHOD(DOMElement, replaceChildren); ZEND_METHOD(DOMElement, insertAdjacentElement); ZEND_METHOD(DOMElement, insertAdjacentText); @@ -659,9 +653,6 @@ ZEND_METHOD(DOMDocument, relaxNGValidateSource); ZEND_METHOD(DOMDocument, validate); ZEND_METHOD(DOMDocument, xinclude); ZEND_METHOD(DOMDocument, adoptNode); -ZEND_METHOD(DOMDocument, append); -ZEND_METHOD(DOMDocument, prepend); -ZEND_METHOD(DOMDocument, replaceChildren); ZEND_METHOD(DOMText, __construct); ZEND_METHOD(DOMText, isWhitespaceInElementContent); ZEND_METHOD(DOMText, splitText); @@ -772,9 +763,9 @@ static const zend_function_entry class_DOMImplementation_methods[] = { static const zend_function_entry class_DOMDocumentFragment_methods[] = { ZEND_ME(DOMDocumentFragment, __construct, arginfo_class_DOMDocumentFragment___construct, ZEND_ACC_PUBLIC) ZEND_ME(DOMDocumentFragment, appendXML, arginfo_class_DOMDocumentFragment_appendXML, ZEND_ACC_PUBLIC) - ZEND_ME(DOMDocumentFragment, append, arginfo_class_DOMDocumentFragment_append, ZEND_ACC_PUBLIC) - ZEND_ME(DOMDocumentFragment, prepend, arginfo_class_DOMDocumentFragment_prepend, ZEND_ACC_PUBLIC) - ZEND_ME(DOMDocumentFragment, replaceChildren, arginfo_class_DOMDocumentFragment_replaceChildren, ZEND_ACC_PUBLIC) + ZEND_MALIAS(DOMElement, append, append, arginfo_class_DOMDocumentFragment_append, ZEND_ACC_PUBLIC) + ZEND_MALIAS(DOMElement, prepend, prepend, arginfo_class_DOMDocumentFragment_prepend, ZEND_ACC_PUBLIC) + ZEND_MALIAS(DOMDocument, replaceChildren, replaceChildren, arginfo_class_DOMDocumentFragment_replaceChildren, ZEND_ACC_PUBLIC) ZEND_FE_END }; @@ -793,10 +784,10 @@ static const zend_function_entry class_DOMCharacterData_methods[] = { ZEND_ME(DOMCharacterData, insertData, arginfo_class_DOMCharacterData_insertData, ZEND_ACC_PUBLIC) ZEND_ME(DOMCharacterData, deleteData, arginfo_class_DOMCharacterData_deleteData, ZEND_ACC_PUBLIC) ZEND_ME(DOMCharacterData, replaceData, arginfo_class_DOMCharacterData_replaceData, ZEND_ACC_PUBLIC) - ZEND_ME(DOMCharacterData, replaceWith, arginfo_class_DOMCharacterData_replaceWith, ZEND_ACC_PUBLIC) - ZEND_ME(DOMCharacterData, remove, arginfo_class_DOMCharacterData_remove, ZEND_ACC_PUBLIC) - ZEND_ME(DOMCharacterData, before, arginfo_class_DOMCharacterData_before, ZEND_ACC_PUBLIC) - ZEND_ME(DOMCharacterData, after, arginfo_class_DOMCharacterData_after, ZEND_ACC_PUBLIC) + ZEND_MALIAS(DOMElement, replaceWith, replaceWith, arginfo_class_DOMCharacterData_replaceWith, ZEND_ACC_PUBLIC) + ZEND_MALIAS(DOMElement, remove, remove, arginfo_class_DOMCharacterData_remove, ZEND_ACC_PUBLIC) + ZEND_MALIAS(DOMElement, before, before, arginfo_class_DOMCharacterData_before, ZEND_ACC_PUBLIC) + ZEND_MALIAS(DOMElement, after, after, arginfo_class_DOMCharacterData_after, ZEND_ACC_PUBLIC) ZEND_FE_END }; @@ -892,8 +883,8 @@ static const zend_function_entry class_DOMDocument_methods[] = { ZEND_ME(DOMDocument, validate, arginfo_class_DOMDocument_validate, ZEND_ACC_PUBLIC) ZEND_ME(DOMDocument, xinclude, arginfo_class_DOMDocument_xinclude, ZEND_ACC_PUBLIC) ZEND_ME(DOMDocument, adoptNode, arginfo_class_DOMDocument_adoptNode, ZEND_ACC_PUBLIC) - ZEND_ME(DOMDocument, append, arginfo_class_DOMDocument_append, ZEND_ACC_PUBLIC) - ZEND_ME(DOMDocument, prepend, arginfo_class_DOMDocument_prepend, ZEND_ACC_PUBLIC) + ZEND_MALIAS(DOMElement, append, append, arginfo_class_DOMDocument_append, ZEND_ACC_PUBLIC) + ZEND_MALIAS(DOMElement, prepend, prepend, arginfo_class_DOMDocument_prepend, ZEND_ACC_PUBLIC) ZEND_ME(DOMDocument, replaceChildren, arginfo_class_DOMDocument_replaceChildren, ZEND_ACC_PUBLIC) ZEND_FE_END };