Fix the issues reported by phpcs

Created on 10 January 2023, almost 2 years ago
Updated 22 June 2023, over 1 year ago

Problem/Motivation

FILE: /Users/projects/drupal-d10/modules/contrib/admin_menu_search/tests/src/Unit/MenuTreeTest.php
 ------ -------------------------------------------------------------------------------------------------------------------
FOUND 40 ERRORS AND 12 WARNINGS AFFECTING 52 LINES
 ------ -------------------------------------------------------------------------------------------------------------------
  73 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
  74 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
  75 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
  80 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
  81 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
  82 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
  87 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
  88 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
  89 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
  94 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
  98 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 102 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 147 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 148 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 149 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 154 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 155 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 156 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 161 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 165 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 218 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 219 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 220 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 225 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 226 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 227 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 232 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 233 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 234 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 239 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 240 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 241 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 246 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 247 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 248 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 253 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 254 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 255 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 263 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 267 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 276 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 285 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 329 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 344 | ERROR   | [ ] The array declaration extends to column 92 (the limit is 80). The array content should be split up over multiple lines
 367 | ERROR   | [x] Array indentation error, expected 12 spaces but found 14
 368 | ERROR   | [x] Array indentation error, expected 12 spaces but found 14
 369 | ERROR   | [x] Array indentation error, expected 12 spaces but found 14
 371 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 375 | ERROR   | [x] Array indentation error, expected 12 spaces but found 14
 376 | ERROR   | [x] Array indentation error, expected 12 spaces but found 14
 377 | ERROR   | [x] Array indentation error, expected 12 spaces but found 14
 379 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 ------ -------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 51 MARKED SNIFF VIOLATIONS AUTOMATICALLY
 ------ -------------------------------------------------------------------------------------------------------------------


FILE: /Users/projects/drupal-d10/modules/contrib/admin_menu_search/tests/src/Unit/ToolbarHandlerTest.php
 ------ ---------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
 ------ ---------------------------------------------------------------------------------------------------
 53 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 75 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 ------ ---------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
 ------ ---------------------------------------------------------------------------------------------------


FILE: /Users/projects/drupal-d10/modules/contrib/admin_menu_search/admin_menu_search.services.yml
---------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------
 4 | ERROR | [x] Expected 1 newline at end of file; 2 found
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------


FILE: /Users/projects/drupal-d10/modules/contrib/admin_menu_search/src/Form/AdminMenuSearchForm.php
 ------ ----------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
 ------ ----------------------------------------------------------------------------------------------
 10 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
 17 | ERROR   | [x] Expected 1 blank line after function; 2 found
 ------ ----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
 ------ ----------------------------------------------------------------------------------------------


FILE: /Users/projects/drupal-d10/modules/contrib/admin_menu_search/src/Controller/AutoCompleteController.php
 ------ -------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
 ------ -------------------------------------------------------------------------------------------------------
 10 | ERROR   | [x] There must be one blank line after the last USE statement; 0 found;
 13 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
 97 | ERROR   | [ ] Type hint "array" missing for $route_parameters
 ------ -------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
 ------ -------------------------------------------------------------------------------------------------------


FILE: /Users/projects/drupal-d10/modules/contrib/admin_menu_search/src/MenuTree.php
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------
  12 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
  46 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 119 | WARNING | Only string literals should be passed to t() where possible
------------------------------------------------------------------------------------------------------------------


FILE: /Users/projects/drupal-d10/modules/contrib/admin_menu_search/src/ToolbarHandler.php
-------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------------
  33 | ERROR   | [ ] Parameter $form_builder is not described in comment
  80 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 105 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------

Time: 189ms; Memory: 12MB

Steps to reproduce

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml admin_menu_search 

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

RTBC

Version

1.0

Component

Code

Created by

🇮🇳India sidharth_soman Bangalore

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

Not all content is available!

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

  • 🇮🇳India rassoni Bangalore

    #4 patch applied successfully. below issues still need to fix. moving to NW.

    FILE: /Users/projects/drupal-d10/modules/contrib/admin_menu_search/src/MenuTree.php
    -------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------
     46 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/projects/drupal-d10/modules/contrib/admin_menu_search/src/ToolbarHandler.php
    -------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------
     107 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -------------------------------------------------------------------------------------------------------------
    
    Time: 160ms; Memory: 12MB
    
    
  • Status changed to Needs work almost 2 years ago
  • 🇮🇳India TanujJain-TJ

    adding new patch to solve dependency injection issue in phpcs, please review.

  • Status changed to Needs review almost 2 years ago
  • Status changed to RTBC over 1 year ago
  • 🇵🇭Philippines paraderojether

    I reviewed patch #9, applied against Admin menu search 8.x-1x-dev, and confirmed it fixes all issues reported by phpcs.

    I added screenshots for reference.
    Thank You.

Production build 0.71.5 2024