[PHP-DEV] Add tidyNode::getNextSibling() and tidyNode::getPreviousSibling()

Hi internals

I opened a PR to add the getNextSibling() and getPreviousSibling() methods to the tidyNode class.
As the class is final, this has no BC break concerns.

The reason for adding this is that it's inconvenient to walk the tree solely using the existing getParent() method and ->child property.
Since it's a tree anyway, methods to obtain the previous or next sibling are natural en convenient.

Just sending this mail to see if anyone objects to this.
PR link: Add tidyNode::getNextSibling() and tidyNode::getPreviousSibling() by nielsdos · Pull Request #15047 · php/php-src · GitHub

Kind regards
Niels

On Sunday, 21 July 2024 at 12:24, Niels Dossche <dossche.niels@gmail.com> wrote:

Hi internals

I opened a PR to add the getNextSibling() and getPreviousSibling() methods to the tidyNode class.
As the class is final, this has no BC break concerns.

The reason for adding this is that it's inconvenient to walk the tree solely using the existing getParent() method and ->child property.

Since it's a tree anyway, methods to obtain the previous or next sibling are natural en convenient.

Just sending this mail to see if anyone objects to this.
PR link: Add tidyNode::getNextSibling() and tidyNode::getPreviousSibling() by nielsdos · Pull Request #15047 · php/php-src · GitHub

Kind regards
Niels

I think this makes sense and is a nice convenience addition.

Best regards,

Gina P. Banyard