Skip to content

Commit 32bd5cf

Browse files
committed
Add test
1 parent 3989c7c commit 32bd5cf

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

tests/PHPStan/Rules/Properties/AccessPropertiesRuleTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,4 +959,12 @@ public function testTraitMixin(): void
959959
$this->analyse([__DIR__ . '/data/trait-mixin.php'], []);
960960
}
961961

962+
public function testDomExtensionLegacyTemplateNodes(): void
963+
{
964+
$this->checkThisOnly = false;
965+
$this->checkUnionTypes = true;
966+
$this->checkDynamicProperties = true;
967+
$this->analyse([__DIR__ . '/data/dom-legacy-ext-template-nodes.php'], []);
968+
}
969+
962970
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
use function PHPStan\Testing\assertType;
4+
5+
function (\DOMNode $node): void {
6+
assertType(DOMNamedNodeMap::class . '<' . DOMAttr::class . '>', $node->attributes);
7+
};
8+
9+
function parse(\DOMElement $node): void
10+
{
11+
assertType(DOMNamedNodeMap::class . '<' . DOMAttr::class . '>', $node->attributes);
12+
$attribute = $node->attributes->getNamedItem('class');
13+
if ($attribute === null) {
14+
return;
15+
}
16+
assertType(DOMAttr::class, $attribute);
17+
assertType('string', $attribute->value);
18+
}

0 commit comments

Comments
 (0)