fix: resolve strict types for ReflectionType and DOMNode

This commit is contained in:
Enes Yakıştır
2026-05-30 11:13:17 +03:00
parent 09f33650ec
commit d219272487
2 changed files with 5 additions and 1 deletions
+2 -1
View File
@@ -24,7 +24,8 @@ class RuleEngine
$reflection = new \ReflectionMethod($rule, 'check');
$params = $reflection->getParameters();
if (isset($params[0]) && $params[0]->getType() && $params[0]->getType()->getName() === 'DOMDocument') {
$type = $params[0]->getType();
if (isset($params[0]) && $type instanceof \ReflectionNamedType && $type->getName() === 'DOMDocument') {
// Document-level rule (Core\AbstractRule style)
$violations = $rule->check($doc);
$allViolations = array_merge($allViolations, $violations);
+3
View File
@@ -16,6 +16,9 @@ class HeadingOrderRule extends AbstractRule
$lastLevel = 0;
foreach ($headings as $h) {
if (!$h instanceof \DOMElement) {
continue;
}
$level = (int)substr($h->tagName, 1);
if ($lastLevel > 0 && $level > $lastLevel + 1) {
$violations[] = $this->createViolation(