- Issue created by @marcus_johansson
- 🇬🇧United Kingdom scott_euser
This looks good to me. I think given 3x is beta, release notes should just make it clear in case anyone is extending any constraints, that they should add the return types + types to their messages in order to remain compatible.
E.g.
class Class1 { public string $message = 'Great message.'; } class Class2 extends Class1 { public $message = 'Great message.'; } $class = new Class2();
Will result in
Fatal error: Type of Class2::$message must be string (as in class Class1)
And
class Class1 { public function myFunction(): string { return 'hello1'; } } class Class2 extends Class1 { public function myFunction() { return 'hello2'; } } $class = new Class2(); print $class->myFunction();
Will result in
Fatal error: Declaration of Class2::myFunction() must be compatible with Class1::myFunction(): string
- 🇮🇳India Vivek Panicker Kolkata
Patch worked for me as well.
Was able to run update hooks successfully. Here's the log while upgrading to Drupal 11.2.0.rc2
Unable to decode output into JSON: Syntax error Fatal error: Declaration of Drupal\field_validation\Plugin\Validation\Constraint\JsonConstr aint::validatedBy() must be compatible with Symfony\Component\Validator\Constraint::validat edBy(): string in /var/www/html/d11site/web/modules/contrib/field_validation/src/Plugin/Valid ation/Constraint/JsonConstraint.php on line 21
MR !15 solved the problem.
+1 for RTBC- 🇦🇺Australia digitalcatalyst
tested this patch when upgrading, from core 11.1.7 to 11.2.0, updates were failing with
PHP Fatal error: Declaration of Drupal\field_validation\Plugin\Validation\Constraint\TimeConstraint::validatedBy() must be compatible with Symfony\Component\Validator\Constraint::validatedBy(): string in /var/www/sites/drupal/multisite/web/modules/contrib/field_validation/src/Plugin/Validation/Constraint/TimeConstraint.php on line 21
after patch updates all ran fine.