Skip to content

Commit ac4dd70

Browse files
authored
Add handy comments for readability
1 parent 0ba6673 commit ac4dd70

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/Unit/Generator/PasswordTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,18 @@ public function testPasswordWithoutSpecialCharacters(): void
5252
$this->assertFalse($this->doesContainSpecialChars($password));
5353
}
5454

55+
/**
56+
* Check if the given password contains any special characters.
57+
*
58+
* @return bool TRUE if it does contain special characters.
59+
*/
5560
private function doesContainSpecialChars(string $password): bool
5661
{
5762
$specialCharacters = ['-', '_', '~', '|', '%', '^', '!', '$', '#', '@', '?'];
5863

5964
foreach (str_split($password) as $character) {
6065
if (in_array($character, $specialCharacters, true)) {
61-
return true;
66+
return true; // exit the loop
6267
}
6368
}
6469
return false;

0 commit comments

Comments
 (0)