Skip to content

Commit

Permalink
When method name is hasUserChanged the return boolean should be true
Browse files Browse the repository at this point in the history
(to match question semantics) and false when user has not changed,
this commits inverts return statements.
  • Loading branch information
canni committed Jan 10, 2012
1 parent c57b528 commit 9d3a49f
Showing 1 changed file with 11 additions and 11 deletions.
Expand Up @@ -89,7 +89,7 @@ public function setUser($user)
if (!$user instanceof UserInterface) {
$changed = true;
} else {
$changed = !$this->hasUserChanged($user);
$changed = $this->hasUserChanged($user);
}
} elseif ($user instanceof UserInterface) {
$changed = true;
Expand Down Expand Up @@ -230,41 +230,41 @@ private function hasUserChanged(UserInterface $user)
}

if ($this->user instanceof EquatableInterface) {
return $this->user->isEqualTo($user);
return !$this->user->isEqualTo($user);
}

if ($this->user->getPassword() !== $user->getPassword()) {
return false;
return true;
}

if ($this->user->getSalt() !== $user->getSalt()) {
return false;
return true;
}

if ($this->user->getUsername() !== $user->getUsername()) {
return false;
return true;
}

if ($this->user instanceof AdvancedUserInterface && $user instanceof AdvancedUserInterface) {
if ($this->user->isAccountNonExpired() !== $user->isAccountNonExpired()) {
return false;
return true;
}

if ($this->user->isAccountNonLocked() !== $user->isAccountNonLocked()) {
return false;
return true;
}

if ($this->user->isCredentialsNonExpired() !== $user->isCredentialsNonExpired()) {
return false;
return true;
}

if ($this->user->isEnabled() !== $user->isEnabled()) {
return false;
return true;
}
} elseif ($this->user instanceof AdvancedUserInterface xor $user instanceof AdvancedUserInterface) {
return false;
return true;
}

return true;
return false;
}
}

0 comments on commit 9d3a49f

Please sign in to comment.