Skip to content

Commit a17a09c

Browse files
authored
Merge pull request #742 from paulbalandan/fix-str-contains
fix: simplify extraction of email parts
2 parents 8455236 + 02d6343 commit a17a09c

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/Authentication/Passwords/NothingPersonalValidator.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,8 @@ protected function isNotPersonal(string $password, ?User $user): bool
7272
$needles = $this->strip_explode($userName);
7373

7474
// extract local-part and domain parts from email as separate needles
75-
if (str_contains($email, '@')) {
76-
[
77-
$localPart,
78-
$domain,
79-
] = explode('@', $email);
80-
} else {
81-
$localPart = $email;
82-
$domain = null;
83-
}
75+
[$localPart, $domain] = explode('@', $email) + [1 => null];
76+
8477
// might be john.doe@example.com and we want all the needles we can get
8578
$emailParts = $this->strip_explode($localPart);
8679
if (! empty($domain)) {

0 commit comments

Comments
 (0)