Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Recursively resolve array definitions #490

Merged
merged 1 commit into from Jun 4, 2017
Merged

[WIP] Recursively resolve array definitions #490

merged 1 commit into from Jun 4, 2017

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.

None yet

2 participants