Skip to content

[11.x] feat: add generics to Container methods#54543

Merged
taylorotwell merged 1 commit into
laravel:11.xfrom
MrMeshok:container-generics
Feb 10, 2025
Merged

[11.x] feat: add generics to Container methods#54543
taylorotwell merged 1 commit into
laravel:11.xfrom
MrMeshok:container-generics

Conversation

@MrMeshok
Copy link
Copy Markdown
Contributor

After #51938 helpers app() and resolve() started to give nice auto completions, but if you have an instance of Application\Container your IDE still sees only mixed, for example in service providers:

$this->app->bind(MyService::class, function (Application $app) {
    app(AnotherService::class)->someMethod(); // Has auto completion
    $app->make(AnotherService::class)->someMethod(); // Doesn't have auto completion
});

This PR adds same generics to methods of Container, there applicable

@taylorotwell taylorotwell merged commit d0ac2bf into laravel:11.x Feb 10, 2025
@MrMeshok MrMeshok deleted the container-generics branch February 10, 2025 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants