Problem/Motivation

In core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php file in function providerPlaceholders() $base_element_a5 is initialized but never used.

Proposed resolution

Remove unused $base_element_a5 variable.

public function providerPlaceholders() {

.........


     // Note the absence of '#create_placeholder', presence of max-age=0 created
     // by the #lazy_builder callback.
     // @todo in https://www.drupal.org/node/2559847
-    $base_element_a5 = [];
     // Note the absence of '#create_placeholder', presence of high cardinality
     // cache context created by the #lazy_builder callback.
     // @see \Drupal\Tests\Core\Render\PlaceholdersTest::callbackPerUser()
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Hardik_Patel_12 created an issue. See original summary.

Status: Needs review » Needs work

The last submitted patch, unsused-variable-removed.patch, failed testing. View results

Hardik_Patel_12’s picture

Status: Needs work » Needs review
apaderno’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#2559847: Auto-placeholdering for #lazy_builder with bubbling of max-age

This is already handled in #2559847: Auto-placeholdering for #lazy_builder with bubbling of max-age where $base_element_a5 is not an empty array anymore.

    // @see \Drupal\Tests\Core\Render\PlaceholdersTest::callbackMaxAgeZero()
    $base_element_a5 = [
      '#attached' => [
        'drupalSettings' => [
          'foo' => 'bar',
        ],
      ],
      'placeholder' => [
        '#cache' => [
          'contexts' => [],
        ],
        '#lazy_builder' => ['Drupal\Tests\Core\Render\PlaceholdersTest::callbackMaxAgeZero', $args],
      ],
    ];