tagName) !== 'a') { return null; } $text = trim($element->textContent); if ($text === '' && !$element->hasAttribute('aria-label') && !$element->hasAttribute('title')) { // Check for images inside $imgs = $element->getElementsByTagName('img'); foreach ($imgs as $img) { if ($img->hasAttribute('alt') && trim($img->getAttribute('alt')) !== '') { return null; } } return $this->createViolation($element, $this->getDescription(), 'Add text content or an aria-label to the link.'); } return null; } }