You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears a few years ago, there was a request to apply default options via reflection on the callable CLI command, and this was implemented via PRs #25 and #26.
I'm in the process of switching over to Silly, and I'm discovering that if you have a callable that is using the __invoke magic method on a class (and thus uses the Invoker library to resolve), its default values aren't considered at all, and instead the console throws an exception that there is no value available for the specified parameter, despite there being a default value specified.
Is this something specifically to do with the __invoke-style callable, or have recent updates (i.e. with PHP-DI's Invoker library) removed this as an option?
I did notice that with PHP-DI's Slim 4 bridge, there is a specific resolver in use (Invoker\ParameterResolver\DefaultValueResolver) that performs this function. It could be that this needs to be incorporated here.
I haven't dug in enough to know exactly what's causing this, but if I can come up with a reliable solution, I will PR one in myself. :)
The text was updated successfully, but these errors were encountered:
Update: took a look at it and it's actually quite a lot simpler than I thought, and is in fact due to this exact thing: the Invoker library needs that DefaultValueResolver to do that reflection-based callable resolution. Should be a very simple addition.
It appears a few years ago, there was a request to apply default options via reflection on the callable CLI command, and this was implemented via PRs #25 and #26.
I'm in the process of switching over to Silly, and I'm discovering that if you have a callable that is using the
__invoke
magic method on a class (and thus uses the Invoker library to resolve), its default values aren't considered at all, and instead the console throws an exception that there is no value available for the specified parameter, despite there being a default value specified.Is this something specifically to do with the
__invoke
-style callable, or have recent updates (i.e. with PHP-DI's Invoker library) removed this as an option?I did notice that with PHP-DI's Slim 4 bridge, there is a specific resolver in use (
Invoker\ParameterResolver\DefaultValueResolver
) that performs this function. It could be that this needs to be incorporated here.I haven't dug in enough to know exactly what's causing this, but if I can come up with a reliable solution, I will PR one in myself. :)
The text was updated successfully, but these errors were encountered: