Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing construct parameter to override tldMessage property #43

Open
wants to merge 1 commit into
base: 7.1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Constraints/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class Url extends Constraint
* @param bool|null $relativeProtocol Whether to accept URL without the protocol (i.e. //example.com) (defaults to false)
* @param string[]|null $groups
* @param bool|null $requireTld Whether to require the URL to include a top-level domain (defaults to false)
* @param string|null $tldMessage Override the default TLD error message
*/
public function __construct(
?array $options = null,
Expand All @@ -54,6 +55,7 @@ public function __construct(
?array $groups = null,
mixed $payload = null,
?bool $requireTld = null,
?string $tldMessage = null,
) {
parent::__construct($options, $groups, $payload);

Expand All @@ -66,6 +68,7 @@ public function __construct(
$this->relativeProtocol = $relativeProtocol ?? $this->relativeProtocol;
$this->normalizer = $normalizer ?? $this->normalizer;
$this->requireTld = $requireTld ?? $this->requireTld;
$this->tldMessage = $tldMessage ?? $this->tldMessage;

if (null !== $this->normalizer && !\is_callable($this->normalizer)) {
throw new InvalidArgumentException(sprintf('The "normalizer" option must be a valid callable ("%s" given).', get_debug_type($this->normalizer)));
Expand Down