Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. XmlFileLoader.php

function XmlFileLoader::validateExtensions

Validates an extension.

Throws

InvalidArgumentException When no extension is found corresponding to a tag

1 call to XmlFileLoader::validateExtensions()
XmlFileLoader::parseFileToDOM in vendor/symfony/dependency-injection/Loader/XmlFileLoader.php
Parses an XML file to a \DOMDocument.

File

vendor/symfony/dependency-injection/Loader/XmlFileLoader.php, line 846

Class

XmlFileLoader
XmlFileLoader loads XML files service definitions.

Namespace

Symfony\Component\DependencyInjection\Loader

Code

private function validateExtensions(\DOMDocument $dom, string $file) : void {
    foreach ($dom->documentElement->childNodes as $node) {
        if (!$node instanceof \DOMElement || 'http://symfony.com/schema/dic/services' === $node->namespaceURI) {
            continue;
        }
        // can it be handled by an extension?
        if (!$this->prepend && !$this->container
            ->hasExtension($node->namespaceURI)) {
            $extensionNamespaces = array_filter(array_map(fn(ExtensionInterface $ext) => $ext->getNamespace(), $this->container
                ->getExtensions()));
            throw new InvalidArgumentException(UndefinedExtensionHandler::getErrorMessage($node->tagName, $file, $node->namespaceURI, $extensionNamespaces));
        }
    }
}
RSS feed
Powered by Drupal