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

Breadcrumb

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

function Definition::getArgument

Gets an argument to pass to the service constructor/factory method.

Throws

OutOfBoundsException When the argument does not exist

2 calls to Definition::getArgument()
ChildDefinition::getArgument in vendor/symfony/dependency-injection/ChildDefinition.php
Gets an argument to pass to the service constructor/factory method.
ChildDefinition::getArgument in vendor/symfony/dependency-injection/ChildDefinition.php
Gets an argument to pass to the service constructor/factory method.
1 method overrides Definition::getArgument()
ChildDefinition::getArgument in vendor/symfony/dependency-injection/ChildDefinition.php
Gets an argument to pass to the service constructor/factory method.

File

vendor/symfony/dependency-injection/Definition.php, line 292

Class

Definition
Definition represents a service definition.

Namespace

Symfony\Component\DependencyInjection

Code

public function getArgument(int|string $index) : mixed {
    if (!\array_key_exists($index, $this->arguments)) {
        throw new OutOfBoundsException(\sprintf('The argument "%s" doesn\'t exist in class "%s".', $index, $this->class));
    }
    return $this->arguments[$index];
}
RSS feed
Powered by Drupal