Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Method "Symfony\Component\Validator\Context\ExecutionContextInterface::getViolations()" will return "ConstraintViolationListInterface" as of its next major version. Doing the same in implementation "Drupal\Core\TypedData\Validation\ExecutionContext" will be required when upgrading.
Method "Symfony\Component\Validator\Context\ExecutionContextInterface::getValidator()" will return "ValidatorInterface" as of its next major version. Doing the same in implementation "Drupal\Core\TypedData\Validation\ExecutionContext" will be required when upgrading.
Method "Symfony\Component\Validator\Context\ExecutionContextInterface::getRoot()" will return "mixed" as of its next major version. Doing the same in implementation "Drupal\Core\TypedData\Validation\ExecutionContext" will be required when upgrading.
Method "Symfony\Component\Validator\Context\ExecutionContextInterface::getValue()" will return "mixed" as of its next major version. Doing the same in implementation "Drupal\Core\TypedData\Validation\ExecutionContext" will be required when upgrading.
Steps to reproduce
Proposed resolution
Add the type hints.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#15 | 3231688-15.patch | 2.36 KB | longwave |
| |||
#2 | 3231688-2.patch | 1.41 KB | daffie |
Issue fork drupal-3231688
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
Comment #2
daffie CreditAttribution: daffie commentedThe fix.
Comment #3
longwaveAs per my comments in #3231683: [Symfony 6] A number of methods of the class Drupal\Core\TypedData\Validation\ExecutionContext are considered internal and Drupal should not override them. I wonder if we can refactor this away entirely.
Comment #4
daffie CreditAttribution: daffie commentedI could not find any instances were contrib is extending the class Drupal\Core\TypedData\Validation\ExecutionContext. The adding of the return type hints do not change anything as the methods already only returning what the added type hints are demanding. See: http://grep.xnddx.ru/search?text=ExecutionContext&filename=.
Part of the Symfony 6 in D10 initiative.
Comment #5
longwaveThe patch adds the typehints as per the deprecation.
Comment #7
larowlanCommitted 1b90015 and pushed to 9.3.x. Thanks!
Comment #8
Luke.LeberI just saw a strange test run with a contrib project that might somewhat be related to this. If this is a red herring, sorry for the noise!
https://www.drupal.org/pift-ci-job/2182122
Comment #9
larowlanA yeah, mixed is PHP8.0 only.
Rolling this one back.
I think that makes this D10 only.
Comment #11
larowlanThanks @Luke.Leber - rolled that back
Comment #13
SpokjeClass
\Drupal\Core\TypedData\Validation\ExecutionContext
is @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. See [#3238432]Since that's the only class changes were made for this issue, and this issue can only be committed in Drupal 10 (in which this class will be deleted), I'm going to put this issue on "Closed (outdated)".
Please correct this if I'm wrong.
Comment #14
daffie CreditAttribution: daffie commented+1 for marking this as outdated. The class is deprecated and will be removed in 10.0.
Comment #15
longwaveReactivating this following the revert in #3255245: [Symfony 6] Revert 3231603 to use our own TranslatorInterface
The latest SF 5.4 run in #3197482: Update Drupal 10 to depend on Symfony 5.4 (as a stepping stone to Symfony 6, for deprecation checking support) shows a few more typehints are needed, fixed in the attached patch.
Comment #16
longwaveComment #17
Taran2LSeems like all required typehints have been added (match Symfony 6 as well). Looks good to me.
Comment #18
Taran2Ljust for the reference, fails from the #3197482-53: Update Drupal 10 to depend on Symfony 5.4 (as a stepping stone to Symfony 6, for deprecation checking support)
Comment #20
catchCommitted b12d11a and pushed to 10.0.x. Thanks!