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

Breadcrumb

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

function YamlFileLoader::validateAlias

Throws

\InvalidArgumentException If one of the provided config keys is not supported, something is missing or the combination is nonsense

1 call to YamlFileLoader::validateAlias()
YamlFileLoader::validate in vendor/symfony/routing/Loader/YamlFileLoader.php

File

vendor/symfony/routing/Loader/YamlFileLoader.php, line 278

Class

YamlFileLoader
YamlFileLoader loads Yaml routing files.

Namespace

Symfony\Component\Routing\Loader

Code

private function validateAlias(array $config, string $name, string $path) : void {
    foreach ($config as $key => $value) {
        if (!\in_array($key, [
            'alias',
            'deprecated',
        ], true)) {
            throw new \InvalidArgumentException(\sprintf('The routing file "%s" must not specify other keys than "alias" and "deprecated" for "%s".', $path, $name));
        }
        if ('deprecated' === $key) {
            if (!isset($value['package'])) {
                throw new \InvalidArgumentException(\sprintf('The routing file "%s" must specify the attribute "package" of the "deprecated" option for "%s".', $path, $name));
            }
            if (!isset($value['version'])) {
                throw new \InvalidArgumentException(\sprintf('The routing file "%s" must specify the attribute "version" of the "deprecated" option for "%s".', $path, $name));
            }
        }
    }
}

API Navigation

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