Skip to content

Commit 7851a35

Browse files
committed
Add asserts to make psalm happy
1 parent fd47a17 commit 7851a35

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/viewmodel/ViewModelRenderer.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
namespace Templado\Engine;
1111

12+
use DOMAttr;
1213
use function array_key_exists;
1314
use function array_reverse;
1415
use function assert;
@@ -460,9 +461,9 @@ private function conditionalApply(DOMElement $context, object|iterable $model):
460461
}
461462

462463
$clone = $matches->item(0)->cloneNode(true);
463-
$parent->insertBefore($clone, $myPointer);
464-
465464
assert($clone instanceof DOMElement);
465+
466+
$parent->insertBefore($clone, $myPointer);
466467
$this->objectApply($clone, $current);
467468

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

603604
foreach ($attributes as $attribute) {
605+
assert($attribute instanceof DOMAttr);
606+
604607
$name = lcfirst(
605608
str_replace(['-', ':'], '', ucwords($attribute->nodeName, '-:'))
606609
);

0 commit comments

Comments
 (0)