Symfony deprecations in Constraint plugins

Created on 2 March 2024, 9 months ago
Updated 28 March 2024, 8 months ago

Problem/Motivation

In πŸ“Œ Convert Constraint plugin discovery to attributes Active , the conversion from using annotations to attributes for Constraint plugins led to tests failing because Symfony deprecation warnings like these:

Remaining self deprecation notices (11)

1x: Method "Symfony\Component\Validator\Constraint::getDefaultOption()"
might add "?string" as a native return type declaration in the future. Do
the same in child class
"Drupal\Core\Validation\Plugin\Validation\Constraint\ValidKeysConstraint"
now to avoid errors or add an explicit @return annotation to suppress this
message.
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData

1x: Method "Symfony\Component\Validator\Constraint::getRequiredOptions()"
might add "array" as a native return type declaration in the future. Do the
same in child class
"Drupal\Core\Validation\Plugin\Validation\Constraint\ValidKeysConstraint"
now to avoid errors or add an explicit @return annotation to suppress this
message.
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData

1x: Method "Symfony\Component\Validator\Constraint::validatedBy()" might
add "string" as a native return type declaration in the future. Do the same
in child class
"Drupal\Core\Validation\Plugin\Validation\Constraint\UuidConstraint" now to
avoid errors or add an explicit @return annotation to suppress this
message.
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData

1x: Method "Symfony\Component\Validator\Constraint::validatedBy()" might
add "string" as a native return type declaration in the future. Do the same
in child class
"Drupal\Core\Validation\Plugin\Validation\Constraint\RegexConstraint" now
to avoid errors or add an explicit @return annotation to suppress this
message.
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData

1x: Method "Symfony\Component\Validator\Constraint::validatedBy()" might
add "string" as a native return type declaration in the future. Do the same
in child class
"Drupal\Core\Validation\Plugin\Validation\Constraint\LengthConstraint" now
to avoid errors or add an explicit @return annotation to suppress this
message.
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData

1x: Method "Symfony\Component\Validator\Constraint::getDefaultOption()"
might add "?string" as a native return type declaration in the future. Do
the same in child class
"Drupal\Core\Validation\Plugin\Validation\Constraint\EntityBundleExistsConstraint"
now to avoid errors or add an explicit @return annotation to suppress this
message.
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData

1x: Method "Symfony\Component\Validator\Constraint::getRequiredOptions()"
might add "array" as a native return type declaration in the future. Do the
same in child class
"Drupal\Core\Validation\Plugin\Validation\Constraint\EntityBundleExistsConstraint"
now to avoid errors or add an explicit @return annotation to suppress this
message.
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData
1x: Method "Symfony\Component\Validator\Constraint::validatedBy()" might
add "string" as a native return type declaration in the future. Do the same
in child class
"Drupal\Core\Validation\Plugin\Validation\Constraint\EmailConstraint" now
to avoid errors or add an explicit @return annotation to suppress this
message.
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData
1x: Method "Symfony\Component\Validator\Constraint::validatedBy()" might
add "string" as a native return type declaration in the future. Do the same
in child class
"Drupal\Core\Validation\Plugin\Validation\Constraint\CountConstraint" now
to avoid errors or add an explicit @return annotation to suppress this
message.
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData
1x: Method "Symfony\Component\Validator\Constraint::getDefaultOption()"
might add "?string" as a native return type declaration in the future. Do
the same in child class
"Drupal\Core\Validation\Plugin\Validation\Constraint\ComplexDataConstraint"
now to avoid errors or add an explicit @return annotation to suppress this
message.
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData
1x: Method "Symfony\Component\Validator\Constraint::getRequiredOptions()"
might add "array" as a native return type declaration in the future. Do the
same in child class
"Drupal\Core\Validation\Plugin\Validation\Constraint\ComplexDataConstraint"
now to avoid errors or add an explicit @return annotation to suppress this
message.
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData
Remaining direct deprecation notices (10)
1x: The "Symfony\Component\Validator\Constraints\Regex::$message"
property is considered final. You should not override it in
"Drupal\Core\Validation\Plugin\Validation\Constraint\RegexConstraint".
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData
1x: The "Symfony\Component\Validator\Constraints\Length::$maxMessage"
property is considered final. You should not override it in
"Drupal\Core\Validation\Plugin\Validation\Constraint\LengthConstraint".
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData
1x: The "Symfony\Component\Validator\Constraints\Length::$minMessage"
property is considered final. You should not override it in
"Drupal\Core\Validation\Plugin\Validation\Constraint\LengthConstraint".
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData
1x: The "Symfony\Component\Validator\Constraints\Length::$exactMessage"
property is considered final. You should not override it in
"Drupal\Core\Validation\Plugin\Validation\Constraint\LengthConstraint".
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData
1x: The "Symfony\Component\Validator\Constraints\Count::$minMessage"
property is considered final. You should not override it in
"Drupal\Core\Validation\Plugin\Validation\Constraint\CountConstraint".
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData
1x: The "Symfony\Component\Validator\Constraints\Count::$maxMessage"
property is considered final. You should not override it in
"Drupal\Core\Validation\Plugin\Validation\Constraint\CountConstraint".
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData
1x: The "Symfony\Component\Validator\Constraints\Count::$exactMessage"
property is considered final. You should not override it in
"Drupal\Core\Validation\Plugin\Validation\Constraint\CountConstraint".
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData
1x: The "Symfony\Component\Validator\Constraints\Choice::$strict"
property is considered final. You should not override it in
"Drupal\Core\Validation\Plugin\Validation\Constraint\AllowedValuesConstraint".
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData
1x: The "Symfony\Component\Validator\Constraints\Choice::$minMessage"
property is considered final. You should not override it in
"Drupal\Core\Validation\Plugin\Validation\Constraint\AllowedValuesConstraint".
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData
1x: The "Symfony\Component\Validator\Constraints\Choice::$maxMessage"
property is considered final. You should not override it in
"Drupal\Core\Validation\Plugin\Validation\Constraint\AllowedValuesConstraint".
1x in
RecursiveContextualValidatorTest::testBasicValidateWithoutConstraints from
Drupal\Tests\Core\TypedData

These warnings were either suppressed or addressed with @return annotations. This is a follow up to address the deprecations:

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Fixed

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 1 hour ago

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024