tagName) !== 'button') { return null; } $html = $element->ownerDocument ? $element->ownerDocument->saveHTML($element) : ''; if ($html !== false && preg_match('/<\?php|\{\{|\{%/i', $html)) { return null; } $text = trim($element->textContent); if ($text === '' && !$element->hasAttribute('aria-label') && !$element->hasAttribute('title')) { return $this->createViolation($element, $this->getDescription(), 'Add text or an aria-label to the button.'); } return null; } }