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

Breadcrumb

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

function FileLoader::setDefinition

Registers a definition in the container with its instanceof-conditionals.

4 calls to FileLoader::setDefinition()
FileLoader::registerClasses in vendor/symfony/dependency-injection/Loader/FileLoader.php
Registers a set of classes as services using PSR-4 for discovery.
XmlFileLoader::parseDefinitions in vendor/symfony/dependency-injection/Loader/XmlFileLoader.php
XmlFileLoader::processAnonymousServices in vendor/symfony/dependency-injection/Loader/XmlFileLoader.php
Processes anonymous services.
YamlFileLoader::parseDefinition in vendor/symfony/dependency-injection/Loader/YamlFileLoader.php

File

vendor/symfony/dependency-injection/Loader/FileLoader.php, line 287

Class

FileLoader
FileLoader is the abstract class used by all built-in loaders that are file based.

Namespace

Symfony\Component\DependencyInjection\Loader

Code

protected function setDefinition(string $id, Definition $definition) : void {
    $this->container
        ->removeBindings($id);
    foreach ($definition->getTag('container.error') as $error) {
        if (isset($error['message'])) {
            $definition->addError($error['message']);
        }
    }
    if ($this->isLoadingInstanceof) {
        if (!$definition instanceof ChildDefinition) {
            throw new InvalidArgumentException(\sprintf('Invalid type definition "%s": ChildDefinition expected, "%s" given.', $id, get_debug_type($definition)));
        }
        $this->instanceof[$id] = $definition;
    }
    else {
        $this->container
            ->setDefinition($id, $definition->setInstanceofConditionals($this->instanceof));
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal