Skip to content

Commit

Permalink
Add asserts to make psalm happy
Browse files Browse the repository at this point in the history
  • Loading branch information
theseer committed Apr 3, 2024
1 parent fd47a17 commit 7851a35
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/viewmodel/ViewModelRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
namespace Templado\Engine;

use DOMAttr;
use function array_key_exists;
use function array_reverse;
use function assert;
Expand Down Expand Up @@ -460,9 +461,9 @@ private function conditionalApply(DOMElement $context, object|iterable $model):
}

$clone = $matches->item(0)->cloneNode(true);
$parent->insertBefore($clone, $myPointer);

assert($clone instanceof DOMElement);

$parent->insertBefore($clone, $myPointer);
$this->objectApply($clone, $current);

if ($clone->hasChildNodes()) {
Expand Down Expand Up @@ -601,6 +602,8 @@ private function objectApply(DOMElement $context, object $model): void {
$attributes = StaticNodeList::fromNamedNodeMap($context->attributes);

foreach ($attributes as $attribute) {
assert($attribute instanceof DOMAttr);

$name = lcfirst(
str_replace(['-', ':'], '', ucwords($attribute->nodeName, '-:'))
);
Expand Down

0 comments on commit 7851a35

Please sign in to comment.