Remove the unused variables

Created on 22 June 2023, over 1 year ago

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\display_fields\includes\display_fields.field_ui.inc
-------------------------------------------------------------------------------------------------------
112 | WARNING | Unused variable $view_mode.
-------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\display_fields\src\AllTokens.php
------------------------------------------------------------------------------------------------------------------------------------------
102 | WARNING | Unused variable $tokens.
------------------------------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\display_fields\src\Element\EntityFieldSelect.php
----------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------------------------------------
201 | WARNING | Unused variable $entity_type.
202 | WARNING | Unused variable $bundle.
255 | WARNING | Unused variable $current_field_name.
----------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\display_fields\src\Plugin\DisplayFieldsField\FieldEmbedView.php
------------------------------------------------------------------------------------------------------------------------------------------
123 | WARNING | Unused variable $display_field_name.
133 | WARNING | Unused variable $key.
134 | WARNING | Unused variable $key_value.
177 | WARNING | Unused variable $display_field_config.
------------------------------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\display_fields\src\Plugin\DisplayFieldsField\FieldReference.php
------------------------------------------------------------------------------------------------------------------------------------------
71 | WARNING | Unused variable $key.
------------------------------------------------------------------------------------------------------------------------------------------

📌 Task
Status

Closed: duplicate

Version

9.1

Component

Code

Created by

🇮🇳India arti_parmar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @arti_parmar
  • Status changed to Active over 1 year ago
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India arti_parmar

    Kindly review patch.

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    -    $tokens = $this->coreToken->getInfo();
    +    $this->coreToken->getInfo();

    Token::getInfo() just returns information for a token. If that information is not necessary, it is not necessary to even call that method.

    -          foreach ($entity->get($current_key) as $key => $value) {
    -            foreach ($value->getValue() as $key_value => $value_value) {
    +          foreach ($entity->get($current_key) as $value) {
    +            foreach ($value->getValue() as $value_value) {
    -
    -    $display_field_config = $field['settings'];
    -
    +    
         // Check the currently selected plugin, and merge persisted values for its
    

    Since this issue is focusing on removing unused variables, and those changes do not involve lines where unused variables are set, those changes are off-topic.
    Also, for empty lines, it is not necessary to add heading spaces.

  • Status changed to Closed: duplicate over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Thank you for the patch!

    Since those are warnings/errors reported by PHP_CodeSniffer, it is preferable to create a single issue to resolve the warnings/errors reported by PHP_CodeSniffer. There is already 📌 Fix the issues reported by PHP_CodeSniffer Postponed , whose scope should be changed to be a broader issue, as described in that issue.

Production build 0.71.5 2024