Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@matt-allan
Copy link
Contributor

Hello,

I was using PHP-DI and noticed that array definitions are only resolved at the first level of the array. For example:

return [
    's3.config' => [
        'version'                  => 'latest',
        'region'                   => DI\env('S3_REGION'), // this resolves
        'bucket'                   => 'stuff',
        'credentials'              => [
            'key'    => DI\env('S3_KEY'),
            'secret' => DI\env('S3_SECRET'),  // these don't
        ],
    ],
    // ...
];

To make this work I changed the ArrayResolver to recurse and added a test.

It looks like ArrayDefinition::__toString would need to change too if this added. I'm not too sure of what the format should be.

@mnapoli
Copy link
Member

mnapoli commented May 22, 2017

Thanks, the reason it wasn't done before is because of the possible performance impact. I think I will need to measure this (I have benchmarks in the repository).

@mnapoli mnapoli added this to the 6.0 milestone May 22, 2017
@mnapoli
Copy link
Member

mnapoli commented May 28, 2017

A quick update: I think the subject of performances may be gone if I succeed with #494. So I will be keeping this pull request around until I can adapt that to the new architecture. I'll let you know, it might take me some time to complete #494

@mnapoli
Copy link
Member

mnapoli commented Jun 4, 2017

Thanks! I've merged manually and apply the same behavior to the compiled container.

I've also opened #498 to apply that kind of logic everywhere.

@matt-allan
Copy link
Contributor Author

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants