You are here

public function DefinitionDecorator::replaceArgument in Zircon Profile 8

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

You should always use this method when overwriting existing arguments of the parent definition.

If you directly call setArguments() keep in mind that you must follow certain conventions when you want to overwrite the arguments of the parent definition, otherwise your arguments will only be appended.

Parameters

int $index:

mixed $value:

Return value

DefinitionDecorator the current instance

Throws

InvalidArgumentException when $index isn't an integer

Overrides Definition::replaceArgument

File

vendor/symfony/dependency-injection/DefinitionDecorator.php, line 202

Class

DefinitionDecorator
This definition decorates another definition.

Namespace

Symfony\Component\DependencyInjection

Code

public function replaceArgument($index, $value) {
  if (!is_int($index)) {
    throw new InvalidArgumentException('$index must be an integer.');
  }
  $this->arguments['index_' . $index] = $value;
  return $this;
}