Skip to content

Commit

Permalink
[+]: fix logic of detecting next sibling dom node v2
Browse files Browse the repository at this point in the history
-> style + phpstan fixes
  • Loading branch information
voku committed Apr 6, 2020
1 parent 67d39fb commit 8e72ae1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/voku/helper/HtmlMin.php
Expand Up @@ -913,6 +913,8 @@ private function domNodeClosingTagOptional(\DOMNode $node): bool
(
$nextSibling === null
&&
$node->parentNode !== null
&&
!\in_array(
$node->parentNode->nodeName,
[
Expand Down Expand Up @@ -1460,7 +1462,7 @@ static function ($matches) {
protected function getNextSiblingOfTypeDOMElement(\DOMNode $node)
{
do {
/** @var \DOMNode|null $node - false-positive error from phpstan */
/** @var \DOMNode|null $nodeTmp - false-positive error from phpstan */
$nodeTmp = $node->nextSibling;

if ($nodeTmp instanceof \DOMText) {
Expand All @@ -1471,12 +1473,11 @@ protected function getNextSiblingOfTypeDOMElement(\DOMNode $node)
) {
$node = $nodeTmp;
} else {
$node = $nodeTmp ? $nodeTmp->nextSibling : null;
$node = $nodeTmp->nextSibling;
}
} else {
$node = $nodeTmp;
}

} while (!($node === null || $node instanceof \DOMElement || $node instanceof \DOMText));

return $node;
Expand Down

0 comments on commit 8e72ae1

Please sign in to comment.