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

Remove duplicate null check #498

Merged
merged 2 commits into from Sep 10, 2019
Merged

Remove duplicate null check #498

merged 2 commits into from Sep 10, 2019

Conversation

8633brown
Copy link
Contributor

@8633brown 8633brown commented Sep 10, 2019

this null check isn't needed as it's already checked in the line above.

edit: the default callback type for Sentinel::register should be a bool.

@@ -309,7 +309,7 @@ public function authenticate($credentials, bool $remember = false, bool $login =

$valid = $user !== null ? $this->users->validateCredentials($user, $credentials) : false;

if ($user === null || ! $valid) {
if (! $valid) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check seems different now i suppose, since above it checks user is not null, here it was checking user was null and not valid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$user can only be null or EloquentUser. If user is null, valid will always be false because the user is null.
If the comparison was && instead of ``||``` I would understand keeping the null check but in the current state $valid can never be true if $user is null.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, i misread the code when i commented out.

It makes sense.

@brunogaspar brunogaspar merged commit 6fba896 into cartalyst:master Sep 10, 2019
@8633brown 8633brown deleted the mod branch September 10, 2019 21:44
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.

None yet

2 participants