Unused variable $entity_type_definition

Created on 4 July 2023, over 1 year ago
Updated 11 July 2023, over 1 year ago

Problem/Motivation

Unused variables are found in $entity_type_definition on line 37 in ContentSyncCommands.php .

Steps to reproduce

1) Install the module.

2) Run this php code standard command to detect the errors reporeted by the php code sniffer.
phpcs --standard=DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml /path/to/drupal/example_module

3) Mention the proper path of the file in which you want to detect the error.

4) once you run the command you will get the list of errors along with the file name.

Proposed resolution

Need to edit the code as per php coding standard.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India Prachi6824

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Comments & Activities

  • Issue created by @Prachi6824
  • Assigned to Prachi6824
  • 🇮🇳India Prachi6824

    Let me work on the issue .

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Prachi6824

    Hello,

    I have created a patch to solve the issue.

    Please review and apply it .

  • Hi ,

    Feel free to do so. Thank you for the patch!
    Still have much refactoring work to do, nice catch.

    Jani

  • @prachi6824 opened merge request.
  • 🇮🇳India Prachi6824

    Hello @bpstr,
    I have created a merge request to merge the code for fixing the issue.
    Thank You.

  • Assigned to jay jangid
  • Issue was unassigned.
  • Status changed to Needs work over 1 year ago
  • 🇮🇳India jay jangid Jaipur

    Hey @prachi6824 whenever I run this cmd
    phpcs --standard=DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml content_entity_sync
    I am getting this type of error:-

    FILE: ...b\modules\contrib\content_entity_sync\src\Commands\ContentSyncCommands.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
    --------------------------------------------------------------------------------
      37 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
      68 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
      89 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
     168 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
    --------------------------------------------------------------------------------
    
    Time: 247ms; Memory: 6MB

    &

    when I run this cmd
    phpcs --standard=Drupal content_entity_sync
    then I am getting this type of error.

    FILE: D:\wamp\www\d9.5\web\modules\contrib\content_entity_sync\src\Commands\ContentSyncCommands.php
    ----------------------------------------------------------------------------------------------------
    FOUND 27 ERRORS AND 3 WARNINGS AFFECTING 29 LINES
    ----------------------------------------------------------------------------------------------------
       1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
       5 | WARNING | [x] Unused use statement
      12 | ERROR   | [x] Missing class doc comment
      14 | WARNING | [ ] Possible useless method overriding detected
      14 | ERROR   | [x] Missing function doc comment
      15 | ERROR   | [x] Opening brace should be on the same line as the declaration
      20 | ERROR   | [ ] Parameter $options is not described in comment
      25 | ERROR   | [x] Separate the @param and @command sections by a blank line.
      65 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
      67 | ERROR   | [x] Data types in @var tags need to be fully namespaced
      68 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 0
      69 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 2
     114 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 11 empty lines
     116 | ERROR   | [ ] More than 2 empty lines are not allowed
     117 | ERROR   | [ ] More than 2 empty lines are not allowed
     118 | ERROR   | [ ] More than 2 empty lines are not allowed
     119 | ERROR   | [ ] More than 2 empty lines are not allowed
     120 | ERROR   | [ ] More than 2 empty lines are not allowed
     121 | ERROR   | [ ] More than 2 empty lines are not allowed
     122 | ERROR   | [ ] More than 2 empty lines are not allowed
     123 | ERROR   | [ ] More than 2 empty lines are not allowed
     124 | ERROR   | [ ] More than 2 empty lines are not allowed
     126 | WARNING | [x] A comma should follow the last multiline array item. Found: )
     128 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 3 empty lines
     130 | ERROR   | [ ] More than 2 empty lines are not allowed
     132 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 3 empty lines
     134 | ERROR   | [ ] More than 2 empty lines are not allowed
     138 | ERROR   | [ ] Parameter $options is not described in comment
     143 | ERROR   | [x] Separate the @param and @command sections by a blank line.
     193 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
    ----------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------
    
    Time: 375ms; Memory: 8MB
  • Assigned to chaitanyadessai
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India chaitanyadessai Goa

    Fixed issues, please review patch.
    ran phpcs command --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,twig

  • Status changed to Fixed over 1 year ago
  • Thank you for the fixes!

  • Status changed to Fixed over 1 year ago
Production build 0.71.5 2024