Skip to content

DI\object()->method() does not support calling same method twice #193

@cristian-fleischer

Description

@cristian-fleischer

This doesn't work:

'My\AddNumbers' => DI\object()
        ->method('addNumber', 1)
        ->method('addNumber', 2),

Only ->method('addNumber', 2) is taken into account.

The method ClassDefinitionHelper::method() (code here) uses the method name as a key for the array that holds methods that should be executed on the constructed object but if you try to call the same method twice it will obviously not work as the array key will be overridden, always retaining only the last method call.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions