Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[Validator] [WIP] remove support for generic constraint option handling#61063

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
xabbuh wants to merge1 commit intosymfony:8.0
base:8.0
Choose a base branch
Loading
fromxabbuh:validator-cleanup

Conversation

xabbuh
Copy link
Member

QA
Branch?8.0
Bug fix?no
New feature?yes
Deprecations?no
Issues
LicenseMIT

opening the PR already even if some polishing needs to be done (and not all tests pass yet) to avoid someone else wasting their time on this topic

@carsonbotcarsonbot added this to the8.0 milestoneJul 8, 2025
@carsonbotcarsonbot changed the title[WIP][Validator] remove support for generic constraint option handling[Validator] [WIP] remove support for generic constraint option handlingJul 8, 2025
@xabbuhxabbuh requested a review fromchalasr as acode ownerJuly 8, 2025 06:58
@xabbuhxabbuhforce-pushed thevalidator-cleanup branch 2 times, most recently fromb8ba9e7 to0c03730CompareJuly 8, 2025 09:25
@@ -32,26 +32,9 @@ class Callback extends Constraint
* @param string[]|null $groups
*/
#[HasNamedArguments]
public function __construct(array|string|callable|null $callback = null, ?array $groups = null, mixed $payload = null, ?array $options = null)
public function __construct(array|string|callable|null $callback = null, ?array $groups = null, mixed $payload = null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

array andnull should be removed from the type (and the default value as well)

}

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

$this->callback = $callback ?? $this->callback;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

should be simplified as$this->callback = $callback instead, as it won't be assigned by the parent constructor anymore

@@ -53,21 +53,9 @@ class CardScheme extends Constraint
* @param array<string,mixed>|null $options
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this phpdoc should also be removed

@@ -53,21 +53,9 @@ class CardScheme extends Constraint
* @param array<string,mixed>|null $options
*/
#[HasNamedArguments]
public function __construct(array|string|null $schemes, ?string $message = null, ?array $groups = null, mixed $payload = null, ?array $options = null)
public function __construct(array|string|null $schemes, ?string $message = null, ?array $groups = null, mixed $payload = null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

array<string,mixed> should be removed from the phpdoc type of$schemes, as that's the part referring to passing options as a positional argument.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

same in most classes (with the appropriate name for the first argument of course)

@@ -32,7 +32,7 @@ public function __construct(mixed $options = null, ?array $groups = null, mixed
throw new ConstraintDefinitionException(\sprintf('You can\'t redefine the "%s" option. Use the "%s::getConstraints()" method instead.', $this->getCompositeOption(), __CLASS__));
}

$this->constraints = $this->getConstraints($this->normalizeOptions($options));
$this->constraints = $this->getConstraints($options ?? []);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We probably need to deprecate using options in this Compound abstract class first, to be able to remove support properly.

public function getDefaultOption(): ?string
{
return 'constraints';
parent::__construct(null, $groups, $payload);
}

protected function getCompositeOption(): string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this method should also be removed, as it does not make sense anymore once the parent does not handle an array of options anymore.

}

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

$this->minScore = $minScore ?? $this->minScore;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
$this->minScore =$minScore ??$this->minScore;
$this->minScore =$minScore;

@xabbuhxabbuhforce-pushed thevalidator-cleanup branch 2 times, most recently from5428b30 toe934b07CompareJuly 11, 2025 18:34
@alexandre-dauboisalexandre-daubois added the BC Layer removalUsed to track BC layer removals before a major release labelJul 11, 2025
@xabbuhxabbuhforce-pushed thevalidator-cleanup branch 4 times, most recently fromf4c40e1 to71a8b66CompareJuly 16, 2025 13:25
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@stofstofstof left review comments

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

Assignees
No one assigned
Labels
BC Layer removalUsed to track BC layer removals before a major releaseFeatureStatus: Needs ReviewValidator
Projects
None yet
Milestone
8.0
Development

Successfully merging this pull request may close these issues.

4 participants
@xabbuh@stof@alexandre-daubois@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp