Skip to content

Commit 698f566

Browse files
IndraGunawanweaverryan
authored andcommitted
change from-email-address default value to empty string
1 parent a9909bc commit 698f566

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Validator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public static function validateDoctrineFieldName(string $name, ManagerRegistry $
167167
return $name;
168168
}
169169

170-
public static function validateEmailAddress(string $email): string
170+
public static function validateEmailAddress(?string $email): string
171171
{
172172
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
173173
throw new RuntimeCommandException(sprintf('"%s" is not a valid email address.', $email));

tests/ValidatorTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,17 @@ public function testValidateClassName()
6868
public function testValidateEmailAddress()
6969
{
7070
$this->assertSame('[email protected]', Validator::validateEmailAddress('[email protected]'));
71+
}
7172

73+
public function testInvalidateEmailAddress()
74+
{
7275
$this->expectException(RuntimeCommandException::class);
7376
$this->expectExceptionMessage('"badEmail" is not a valid email address.');
7477
Validator::validateEmailAddress('badEmail');
78+
79+
$this->expectException(RuntimeCommandException::class);
80+
$this->expectExceptionMessage('"" is not a valid email address.');
81+
Validator::validateEmailAddress('');
7582
}
7683

7784
public function testInvalidClassName()

0 commit comments

Comments
 (0)