Skip to content

Commit 76c4303

Browse files
committed
fix: remove unneeded conditions
1 parent fb85314 commit 76c4303

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

src/Authentication/Authenticators/Session.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public function checkAction(UserIdentity $identity, string $token): bool
241241
throw new LogicException('Cannot get the User.');
242242
}
243243

244-
if ($token === '' || $token === '0' || $token !== $identity->secret) {
244+
if ($token === '' || $token !== $identity->secret) {
245245
return false;
246246
}
247247

@@ -767,7 +767,7 @@ private function issueRememberMeToken(): void
767767

768768
// Reset so it doesn't mess up future calls.
769769
$this->shouldRemember = false;
770-
} elseif ($this->getRememberMeToken() !== null && $this->getRememberMeToken() !== '' && $this->getRememberMeToken() !== '0') {
770+
} elseif ($this->getRememberMeToken() !== null) {
771771
$this->removeRememberCookie();
772772

773773
// @TODO delete the token record.
@@ -935,6 +935,9 @@ private function calcExpires(): Time
935935
return Time::createFromTimestamp($timestamp);
936936
}
937937

938+
/**
939+
* @param non-empty-string $rawToken
940+
*/
938941
private function setRememberMeCookie(string $rawToken): void
939942
{
940943
/** @var Response $response */

src/Authentication/Passwords.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function check(string $password, ?User $user = null): Result
112112

113113
$password = trim($password);
114114

115-
if ($password === '' || $password === '0') {
115+
if ($password === '') {
116116
return new Result([
117117
'success' => false,
118118
'reason' => lang('Auth.errorPasswordEmpty'),

src/Authentication/Passwords/NothingPersonalValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ protected function isNotPersonal(string $password, ?User $user): bool
8585

8686
// might be john.doe@example.com and we want all the needles we can get
8787
$emailParts = $this->strip_explode($localPart);
88-
if ($domain !== null && $domain !== '' && $domain !== '0') {
88+
if ($domain !== null && $domain !== '') {
8989
$emailParts[] = $domain;
9090
}
9191
$needles = [...$needles, ...$emailParts];

src/Authentication/Traits/HasAccessTokens.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function accessTokens(): array
9797
*/
9898
public function getAccessToken(?string $rawToken): ?AccessToken
9999
{
100-
if ($rawToken === null || $rawToken === '' || $rawToken === '0') {
100+
if ($rawToken === null || $rawToken === '') {
101101
return null;
102102
}
103103

tests/Authentication/Filters/AbstractFilterTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private function addRoutes(): void
6161
{
6262
$routes = service('routes');
6363

64-
$filterString = isset($this->routeFilter) && ($this->routeFilter !== '' && $this->routeFilter !== '0')
64+
$filterString = isset($this->routeFilter) && ($this->routeFilter !== '')
6565
? $this->routeFilter
6666
: $this->alias;
6767

0 commit comments

Comments
 (0)