Skip to content

Improve DomNode methods return type #1761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 13, 2025
Merged

Conversation

VincentLanglet
Copy link
Contributor

* The old node.
* </p>
* @return DOMNode|false The old node or false if an error occur.
* @return TNode|false The old node or false if an error occur.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the phpdoc and https://www.php.net/manual/en/domnode.replacechild.php
the old node is returned which is the second param if I understand.

* The removed child.
* </p>
* @return DOMNode If the child could be removed the functions returns the old child.
* @return TNode|false If the child could be removed the functions returns the old child.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This returns the child removed (which is the one in param)
AND false was missing

https://www.php.net/manual/en/domnode.removechild.php

* The appended child.
* </p>
* @return DOMNode The node added.
* @return TNode|false The node added.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This returns the node added (which is coming form the param)
AND false was missing

https://www.php.net/manual/en/domnode.appendchild.php

* The new node.
* </p>
* @param null|DOMNode $child [optional] <p>
* The reference node. If not supplied, newnode is
* appended to the children.
* </p>
* @return DOMNode The inserted node.
* @return TNode|false The inserted node.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the phpdoc and https://www.php.net/manual/en/domnode.insertbefore.php
it returns the node inserted, which is the one coming from the param.

AND false was missing

@@ -226,7 +230,7 @@ public function hasChildNodes(): bool {}
* Indicates whether to copy all descendant nodes. This parameter is
* defaulted to false.
* </p>
* @return static The cloned node.
* @return static|false The cloned node.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VincentLanglet
Copy link
Contributor Author

I saw you review some of my PR @LolGleb ; do you mind taking a look at this one too ? Thanks

@isfedorov isfedorov merged commit 1a686de into JetBrains:master Aug 13, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants