Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Validator] Define which collection keys should be checked for uniqueness #42403

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

Closed
wants to merge 12 commits into from
Prev Previous commit
Next Next commit
Add type declarations
  • Loading branch information
wkania committed Apr 3, 2022
commit 915586d5b99801e862eedecd57f1a17d3e78b749
8 changes: 4 additions & 4 deletions 8 src/Symfony/Component/Validator/Constraints/Unique.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Unique extends Constraint
{
public const IS_NOT_UNIQUE = '7911c98d-b845-4da0-94b7-a8dac36bc55a';

public $fields = [];
public array|string $fields = [];

protected const ERROR_NAMES = [
self::IS_NOT_UNIQUE => 'IS_NOT_UNIQUE',
Expand All @@ -50,7 +50,7 @@ public function __construct(
callable $normalizer = null,
array $groups = null,
mixed $payload = null,
$fields = null,
array|string $fields = null,
) {
if (\is_array($fields) && \is_string(key($fields))) {
nicolas-grekas marked this conversation as resolved.
Show resolved Hide resolved
$options = array_merge($fields, $options);
Expand All @@ -68,12 +68,12 @@ public function __construct(
}
}

public function getOptions()
public function getOptions(): array
{
return ['fields'];
}

public function getDefaultOption()
public function getDefaultOption(): string
{
return 'fields';
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.