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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Adds finally method to pipeline helper #54110

Merged
merged 3 commits into from
Jan 7, 2025
Merged

Conversation

nunomaduro
Copy link
Member

This pull request adds the finally method to pipeline helper, so we can specify a callback to be executed regardless of the outcome of the pipeline.

This is the before:

try {
    $result = Pipeline::send($deployment)
        ->through([PipeOne::class, PipeTwo::class]) // one of the pipes does not call the $next or throws an exception...
        ->then(fn () => $deployment->deploy());
} finally {
    // perform clean up...
}

This is the after:

$result = Pipeline::send($deployment)
     ->through([PipeOne::class, PipeTwo::class]) // one of the pipes does not call the $next or throws an exception...
     ->finally(fn () => /** perform clean up */)
     ->then(fn () => $deployment->deploy());

@parijke
Copy link

parijke commented Jan 7, 2025

@taylorotwell taylorotwell merged commit f80c63d into 11.x Jan 7, 2025
39 checks passed
@taylorotwell taylorotwell deleted the feat/pipeline-finally branch January 7, 2025 23:29
@taylorotwell
Copy link
Member

@parijke our facades are updated automatically by a script.

@parijke
Copy link

parijke commented Jan 8, 2025

@parijke our facades are updated automatically by a script.

That is cool @taylorotwell wow!

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.

4 participants