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

Suggestion/Discuss: Standardize use of direct Auth::User #907

Open
SpeedyD opened this issue Apr 14, 2024 · 1 comment
Open

Suggestion/Discuss: Standardize use of direct Auth::User #907

SpeedyD opened this issue Apr 14, 2024 · 1 comment

Comments

@SpeedyD
Copy link
Contributor

SpeedyD commented Apr 14, 2024

We should at some point consider to replace all (Auth::check() ? Auth::user() : null) with (Auth::user() ?? null).

Having Auth::check(), which sole purpose is to see if Auth:user() is not null, in the same line as checking Auth::user(), is not great. It would be better if we were to replace it by a singular check, which immediately gave the required result as well.

On another note, there is different kind of check, the if(Auth:check() && Auth:user()) variant- we may want to consider looking into a solution for those as well, though that is a different story entirely.

I'd like to open this issue for discussion.

@itinerare
Copy link
Collaborator

itinerare commented Apr 14, 2024

This is arguably one of those things that can be done whenever, since it's not a breaking change. It's also really not that dire a thing, but would be nice since it makes things a little tidier.

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

No branches or pull requests

2 participants