public function Definition::replaceArgument

Sets a specific argument

@api

Parameters

integer $index:

mixed $argument:

Return value

Definition The current instance

Throws

OutOfBoundsException When the replaced argument does not exist

1 method overrides Definition::replaceArgument()
DefinitionDecorator::replaceArgument in drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/DefinitionDecorator.php
You should always use this method when overwriting existing arguments of the parent definition.

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Definition.php, line 252

Class

Definition
Definition represents a service definition.

Namespace

Symfony\Component\DependencyInjection

Code

public function replaceArgument($index, $argument) {
  if ($index < 0 || $index > count($this->arguments) - 1) {
    throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, count($this->arguments) - 1));
  }
  $this->arguments[$index] = $argument;
  return $this;
}