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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: properly bind singleton #291

Merged
merged 1 commit into from Jul 14, 2020

Conversation

mr-feek
Copy link
Contributor

@mr-feek mr-feek commented Jul 14, 2020

fixes #290

馃憢 You may want to consider bringing in psalm to help ya out!

The typehint for Container::singleton is @param \Closure|string|null $concrete https://github.com/laravel/framework/blob/7.x/src/Illuminate/Container/Container.php#L352

@freekmurze freekmurze merged commit 41989c6 into facade:master Jul 14, 2020
@freekmurze
Copy link
Collaborator

Thanks!

Comment on lines -29 to +31
$this->app->singleton(MultiDumpHandler::class, $multiDumpHandler);
$this->app->singleton(MultiDumpHandler::class, function () use ($multiDumpHandler) {
return $multiDumpHandler;
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this just be ?

$this->app->instance(MultiDumpHandler::class, $multiDumpHandler);

This would be also more clearly convey the intend here. The closure factory looks redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i always forget about instance -- both should have the same effect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants