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

Always interpret closures as factories #487

Closed
mnapoli opened this Issue May 16, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@mnapoli
Copy link
Member

mnapoli commented May 16, 2017

When a factory is at the root of the definition array, it is automatically interpreted as a factory (DI\factory() is not necessary).

However it's not the case if the closure is in an array or an object parameter.

We could simplify the behavior and always consider a closure as a factory. If a user wants to really inject a closure, DI\value() is here for that. The behavior will at least be more consistent and simple.

@mnapoli mnapoli added the enhancement label May 16, 2017

@mnapoli mnapoli added this to the 6.0 milestone May 16, 2017

mnapoli added a commit that referenced this issue Nov 4, 2017

@mnapoli mnapoli closed this in #540 Nov 10, 2017

mnapoli added a commit that referenced this issue Nov 10, 2017

Merge pull request #540 from PHP-DI/handle-nested-definitions
Rework how nested definitions are handled (fix #501 & #487)

mnapoli added a commit that referenced this issue Feb 10, 2018

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