Skip to content

Conversation

@daniser
Copy link
Contributor

@daniser daniser commented Sep 11, 2025

This PR enables infinite chaining of ContextualBindingBuilder methods.

Before:

$this->app->when(MyService::class)->needs(Repository::class)->give(
    fn () => Cache::store(config('my-service.cache.store'))
);
$this->app->when(MyService::class)->needs('$ttl')->giveConfig('my-service.cache.ttl');

After:

$this->app->when(MyService::class)
    ->needs(Repository::class)->give(
        fn () => Cache::store(config('my-service.cache.store'))
    )
    ->needs('$ttl')->giveConfig('my-service.cache.ttl');

@taylorotwell taylorotwell merged commit 52d6a31 into laravel:12.x Sep 12, 2025
77 of 81 checks passed
tegos pushed a commit to tegos/laravel-framework that referenced this pull request Sep 28, 2025
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