diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c index dda7a42a12964..36298f526830f 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 7d9ec93169a15..a760e3a425b5f 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 3326809172028..e3d9db7238105 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 7316f8426698b..e18e2d6c7beac 100644 --- a/ext/dom/php_dom.stub.php +++ b/ext/dom/php_dom.stub.php @@ -471,13 +471,22 @@ public function __construct() {} /** @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 {} } @@ -523,15 +532,25 @@ public function deleteData(int $offset, int $count): bool {} /** @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 {} } @@ -829,10 +848,16 @@ public function xinclude(int $options = 0): int|false {} /** @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 76d8b0af2b0b5..b9d543b10bb23 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: ebe9bcbd185e1973b5447beb306bd9d93051f415 */ + * Stub hash: 559f162e2347d7a5c29651ba5ec13ec0ee06c7bb */ 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) @@ -559,9 +559,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); @@ -570,10 +570,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); @@ -597,12 +597,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); @@ -654,9 +648,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); @@ -766,9 +757,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 }; @@ -787,10 +778,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 }; @@ -886,8 +877,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 };