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

use Conditionable on Exceptions #52946

Draft
wants to merge 2 commits into
base: 11.x
Choose a base branch
from

Conversation

hosseinakbari8013
Copy link

@hosseinakbari8013 hosseinakbari8013 commented Sep 26, 2024

This PR gives capabilities to the Exceptions class so that users can write their codes with better quality.
In this PR, Illuminate\Support\Traits\Conditionable is used in the Illuminate\Foundation\Configuration\Exception class, so the exception will accept the when() and unless() functions.
You can see a difference in the use of this function:

With out using when() (Execution of n conditions for n exceptions)
image

With using when() (Execution of 1 conditions for n exceptions)
image

note: I had no idea to make a new test for these changes, so I ask you to check it out, Thank's.

@taylorotwell
Copy link
Member

How would request be injected into your when callback?

@taylorotwell taylorotwell marked this pull request as draft September 27, 2024 14:42
@shaedrich
Copy link

Wouldn't it make more sense to add a withExceptions() method to \Illuminate\Routing\Router?

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.

3 participants