Skip to content

Commit

Permalink
feat: add bc layer on validation constraints options
Browse files Browse the repository at this point in the history
This is related to #102 that remove the part that I add here.
  • Loading branch information
Nek- committed Feb 23, 2022
1 parent 93244ab commit 2a439d6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Validator/Constraints/PhoneNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,23 @@ class PhoneNumber extends Constraint
/**
* {@inheritdoc}
*
* @param string|array|null $format
* @param int|array|null $format Specify the format (\libphonenumber\PhoneNumberFormat::*)
* or options (an associative array)
* @param string|array|null $type
*/
public function __construct($format = null, $type = null, string $defaultRegion = null, string $regionPath = null, string $message = null, array $groups = null, $payload = null, array $options = [])
{
if (\is_array($format)) {
@trigger_error('Usage of the argument $format to specify options is deprecated and will be removed in 4.0. Use "$option" argument instead.', \E_USER_DEPRECATED);
$options = array_merge($format, $options);
} else {
$phoneFormat = $format;
}

parent::__construct($options, $groups, $payload);

$this->message = $message ?? $this->message;
$this->format = $format ?? $this->format;
$this->format = $phoneFormat ?? $this->format;
$this->type = $type ?? $this->type;
$this->defaultRegion = $defaultRegion ?? $this->defaultRegion;
$this->regionPath = $regionPath ?? $this->regionPath;
Expand Down

0 comments on commit 2a439d6

Please sign in to comment.