You are here

public function Definition::replaceArgument in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Definition.php \Symfony\Component\DependencyInjection\Definition::replaceArgument()

Sets a specific argument.

@api

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 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/DefinitionDecorator.php
You should always use this method when overwriting existing arguments of the parent definition.

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Definition.php, line 332

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