build: upgrade PHPStan to level 9 and fix strict type errors

This commit is contained in:
Enes Yakıştır
2026-06-06 09:36:46 +03:00
parent 1ea2579d20
commit 75171c6f96
14 changed files with 124 additions and 77 deletions
+7 -4
View File
@@ -29,10 +29,13 @@ class FormLabel extends AbstractRule
if ($element->hasAttribute('id')) {
$id = $element->getAttribute('id');
$xpath = new \DOMXPath($element->ownerDocument);
$labels = $xpath->query("//label[@for='$id']");
if ($labels->length > 0) {
return null;
$doc = $element->ownerDocument;
if ($doc !== null) {
$xpath = new \DOMXPath($doc);
$labels = $xpath->query("//label[@for='$id']");
if ($labels !== false && $labels->length > 0) {
return null;
}
}
}