TwigNodeTrans use default values as parameters before non-optional parameter

Created on 14 September 2016, over 8 years ago
Updated 29 January 2023, almost 2 years ago

Problem/Motivation

In Drupal\Core\Template\TwigNodeTrans constructor, \Twig_Node $plural, \Twig_Node_Expression $count and \Twig_Node_Expression $options parameters are null as default value, but next parameter $lineno is required.

  public function __construct(\Twig_Node $body, \Twig_Node $plural = NULL, \Twig_Node_Expression $count = NULL, \Twig_Node_Expression $options = NULL, $lineno, $tag = NULL) {
    // ...
  }

As $lineno is required, $previous parameters are always setted.

Proposed resolution

As $previous is required, default value before this parameter can safely be removed.

  public function __construct(\Twig_Node $body, \Twig_Node $plural, \Twig_Node_Expression $count, \Twig_Node_Expression $options, $lineno, $tag = NULL) {
    // ...
  }
📌 Task
Status

Needs work

Version

10.1

Component
Theme 

Last updated about 6 hours ago

Created by

🇫🇷France goz

Live updates comments and jobs are added and updated live.
  • Quick fix

    Very small and simple change. Preferred over Quickfix.

  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

    Since we changing the constructor believe we will need a change record to announce that the parameter can now be NULL.

    Won't tag for it but maybe a test case showing what happens when you pass null in what happens.

Production build 0.71.5 2024