-
-
Notifications
You must be signed in to change notification settings - Fork 834
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
Fix Callables for Extenders #2423
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not tested locally. Looks good, just one comment.
… an invokable class.
…ocessor extenders accept callbacks
[ci skip] [skip ci]
4d3e137
to
104fbe3
Compare
[ci skip] [skip ci]
$callback = function () use ($container, $callback) { | ||
$callback = $container->make($callback); | ||
|
||
return call_user_func_array($callback, func_get_args()); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just $callback = $container->make($callback);
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clark pointed out in #2176 (comment) that $callback = $container->make($callback);
means that the callback will be resolved every time the site boots, even if its not needed for that request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad, didn't see that..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do agree it's a bit ugly, if there are simpler ways to do it, I'm all ears. But at least with the util, it's abstracted away so if we need to change it, that should be easy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks good to me 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good with the helper! Some more comments.
@clarkwinkelmann fixed! Any thoughts on naming for the util? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Fixes #2401, mostly minor cleanup and adding tests to prevent regressions.