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

Breadcrumb

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

function CheckDefinitionValidityPass::validateAttributes

1 call to CheckDefinitionValidityPass::validateAttributes()
CheckDefinitionValidityPass::process in vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php
Processes the ContainerBuilder to validate the Definition.

File

vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php, line 87

Class

CheckDefinitionValidityPass
This pass validates each definition individually only taking the information into account which is contained in the definition itself.

Namespace

Symfony\Component\DependencyInjection\Compiler

Code

private function validateAttributes(string $id, string $tag, array $attributes, array $path = []) : void {
    foreach ($attributes as $name => $value) {
        if (\is_array($value)) {
            $this->validateAttributes($id, $tag, $value, [
                $path,
                $name,
            ]);
        }
        elseif (!\is_scalar($value) && null !== $value) {
            $name = implode('.', [
                $path,
                $name,
            ]);
            throw new RuntimeException(\sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s".', $id, $tag, $name));
        }
    }
}
RSS feed
Powered by Drupal