-
-
Notifications
You must be signed in to change notification settings - Fork 324
Extend a previous object definition to add method calls #349
Copy link
Copy link
Closed
Description
DI\object()->method() behaves somewhat unexpected when extending objects.
Here is an example:
// definitions1.php
return [
MyClass::class=>DI\object()
->method('setConfiguration', 'a config value')
->method('addSomething', 'something')
->method('addSomething', 'another something')
];
// definitions2.php
return [
MyClass::class=>DI\object()
->method('setConfiguration', 'a new config value')
->method('addSomething', 'just another something')
];My expectation was, that "addSomething" is called three times but it is not. In fact the first call with "something" is replaced with "just another something". I know that this is great if you set something and want to override the value later. But what is the right way to explicitly add a method call?
Reactions are currently unavailable