tagName); if ($tag !== 'ul' && $tag !== 'ol') { return null; } foreach ($element->childNodes as $child) { if ($child instanceof DOMElement) { $childTag = strtolower($child->tagName); if (!in_array($childTag, ['li', 'script', 'template'], true)) { return $this->createViolation( $element, sprintf('List element <%s> contains invalid direct child <%s>. Only
  • elements are allowed.', $tag, $childTag), 'Wrap the child element in an
  • tag, or move it outside the list structure.' ); } } } return null; } }