You are here

public function Definition::replaceArgument in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/Definition.php \Symfony\Component\DependencyInjection\Definition::replaceArgument()

Sets a specific argument.

Parameters

int $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 vendor/symfony/dependency-injection/DefinitionDecorator.php
You should always use this method when overwriting existing arguments of the parent definition.

File

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

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;
}