-
-
Notifications
You must be signed in to change notification settings - Fork 324
Standardize definition handling in nested definitions/arrays #498
Copy link
Copy link
Closed
Milestone
Description
Currently there are inconsistencies when definitions are at the root of the array or nested in:
- arrays (see also [WIP] Recursively resolve array definitions #490, Autowiring and Annotations do not work for
DI\object()inside arrays #343) - other definitions
- arrays nested in other definitions (Always interpret closures as factories #487, Standardize definition handling in nested definitions/arrays #498)
The goal would be to make all those behaviors identical (less surprises). Since the container is now compiled performances should not be a problem.
example of test case to reuse:
/**
* @dataProvider provideContainer
*/
public function test_nested_array_with_nested_definitions_in_sub_definition(ContainerBuilder $builder)
{
$builder->addDefinitions([
SimpleClass::class => create()
->property(
'dependency',
[
\DI\env('PHP_DI_DO_NOT_DEFINE_THIS', 'env'),
\DI\create('stdClass'),
]
),
]);
$container = $builder->build();
$object = $container->get(SimpleClass::class);
$this->assertEquals('env', $object->dependency[0]);
$this->assertEquals(new \stdClass, $object->dependency[1]);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels