Skip to content

Commit

Permalink
Fix Phone Pattern Regex
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieu-ducrot committed Mar 25, 2024
1 parent 27192ef commit 8445555
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Utils/RegexUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class RegexUtils
{
public const PHONE_PATTERN = '#^(\+[0-9]{2})?[0-9]{10}$#';
public const PHONE_PATTERN = '#^(\+[0-9]{1})?[0-9]{10}$#';
public const PHONE_MESSAGE = 'phone.regex_error';
public const FAX_MESSAGE = 'fax.regex_error';

Expand Down
4 changes: 2 additions & 2 deletions tests/Validator/Constraints/RegexValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function validPhoneProvider(): array
{
return [
'concatenated number ' => ["0601020304"],
'number with dial code without space' => ["+330601020304"],
'number with dial code without space' => ["+33601020304"],
];
}

Expand All @@ -62,7 +62,7 @@ public function unvalidPhoneProvider(): array
'number with point' => ["06.01.02.03.04"],
'number with separator combination' => ["0601 02-03.04"],
'grouping of digits other than 2' => ["060 102 0304"],
'missing + for dialing code' => ["330601020304"],
'missing + for dialing code' => ["33601020304"],
'number with dial code with space' => ["+33 06 01 02 03 04"],
];
}
Expand Down

0 comments on commit 8445555

Please sign in to comment.