[DI] Add support for immutable setters in CallTrait

This commit is contained in:
Lctrs 2019-12-11 13:18:13 +01:00
parent 3df1d1efe0
commit 90ace51328

View File

@ -18,16 +18,17 @@ trait CallTrait
/** /**
* Adds a method to call after service initialization. * Adds a method to call after service initialization.
* *
* @param string $method The method name to call * @param string $method The method name to call
* @param array $arguments An array of arguments to pass to the method call * @param array $arguments An array of arguments to pass to the method call
* @param bool $returnsClone Whether the call returns the service instance or not
* *
* @return $this * @return $this
* *
* @throws InvalidArgumentException on empty $method param * @throws InvalidArgumentException on empty $method param
*/ */
final public function call($method, array $arguments = []) final public function call($method, array $arguments = [], $returnsClone = false)
{ {
$this->definition->addMethodCall($method, static::processValue($arguments, true)); $this->definition->addMethodCall($method, static::processValue($arguments, true), $returnsClone);
return $this; return $this;
} }