Problem/Motivation
Whenever service arguments are changed, a BC layer is needed to avoid fatal errors like
ArgumentCountError: Too few arguments to function Drupal\twig_field_value\Twig\Extension\FieldValueExtension::__construct(), 4 passed in /core/lib/Drupal/Component/DependencyInjection/Container.php on line 261 and exactly 5 expected in Drupal\twig_field_value\Twig\Extension\FieldValueExtension->__construct() (line 78 of /modules/contrib/twig_field_value/src/Twig/Extension/FieldValueExtension.php)
See #3471185: 2.0.3 update should rebuild containers for the previous attempts of fixing it.
Steps to reproduce
Update the module
Proposed resolution
Add a BC layer
Remaining tasks
Review a PR
User interface changes
None
API changes
The @twig_field_value.twig.extension service constructor now requires @renderer as its 5th parameter
Data model changes
None
Issue fork twig_field_value-3478474
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 #3
taran2lComment #4
taran2lComment #5
anybodyThank you very very much @taran2l for providing the example! LGTM!
@Grevil what would you say?
Any further references in the docs that it should be done this way? (Technically it makes sense to me, but also adds some boilerplate)
@taran2l added a good explanation here:
https://www.drupal.org/project/twig_field_value/issues/3471185#comment-1...
Comment #6
grevil commentedWow, that is super annoying for such a simple change! Haven't seen that yet.
One last thing:
__constrcut()=> __construct().That's crazy though... one more reason to actually not use dependency injection....
Comment #7
grevil commentedAlright, changed the CR typo myself.
Should be good to go now!
Comment #9
grevil commentedThank you @taran2l!