Problem/Motivation

Symfony 8 drops support for passing an array of options as an argumentto the base Constraint constructor. In Drupal 12, we can remove the $options argument to all the Drupal constraint classes.

Also, Symfony has deprecated the getDefaultOption() and getRequiredOptions() methods in
Symfony\Component\Validator\Constraint in 7.4 and removed in Symfony 8. Implementations of these methods in Drupal constraint classes should be removed in Drupal 12.

The below has been moved to #3569092: Update method signatures for addConstraint() and ConstraintManager::create() and remove HasNamedArguments use so that update to Symfony 8 can possibly be unblocked sooner.
The #[HasNamedArgument] attribute is also removed from Symfony 8, so that attribute and the BC layer in ConstraintManager/ConstraintFactory will need to be removed as well.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3569096

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

godotislate created an issue. See original summary.

godotislate’s picture

Title: [12.x] Remove $options argument from Constraint plugin constructors » [12.x] Remove BC layer with HasNamedArgument attribute, $options argument from Constraint plugin constructors
Issue summary: View changes
godotislate’s picture

Title: [12.x] Remove BC layer with HasNamedArgument attribute, $options argument from Constraint plugin constructors » [12.x] Remove BC layer $options argument from Constraint plugin constructors
Issue summary: View changes
Related issues: +#3569093: [12.x] Remove getDefaultOption() and getRequiredOptions() methods in Drupal Constraint plugin classe

godotislate’s picture

Status: Active » Needs review

MR is ready for review https://git.drupalcode.org/project/drupal/-/merge_requests/15601

Testing is code review + checking codebase that all Constraint classes don't have the $options parameter in the constructor.

Also no implementations of getDefaultOption and getRequiredOptions.

quietone’s picture

Title: [12.x] Remove BC layer $options argument from Constraint plugin constructors » Remove BC layer $options argument from Constraint plugin constructors
Issue tags: +12.0.0 release priority

Changing to using tag instead of version number in the title.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Applied the MR (took forever with airplane internet) and applied and did search for "mixed $options = NULL," and "?string $prefix = NULL," with all hits being removed.

LGTM.

longwave’s picture

Status: Reviewed & tested by the community » Needs work

Added a couple of review comments.

godotislate’s picture

Status: Needs work » Needs review

Addressed MR comments, back to NR.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Believe feedback has been addressed. Correct me if I'm wrong.

  • longwave committed 8447a07e on main
    refactor: #3569096 Remove BC layer $options argument from Constraint...
longwave’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 8447a07e0ee to main. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.