Fix the issues reported by phpcs

Created on 19 January 2023, almost 2 years ago
Updated 21 September 2023, about 1 year ago

Problem/Motivation

FILE: /Users/sahil.goyal/Documents/MySites/contrib10/drupal10/modules/contrib/workbench/workbench.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
 1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
 1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
 1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/contrib10/drupal10/modules/contrib/workbench/workbench.module
--------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------------
 77 | ERROR | Missing parameter type
 80 | ERROR | Description for the @return value is missing
--------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/contrib10/drupal10/modules/contrib/workbench/workbench.api.php
---------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 1 WARNING AFFECTING 5 LINES
---------------------------------------------------------------------------------------------------------
 27 | ERROR   | [ ] Missing parameter type
 30 | ERROR   | [ ] @return doc comment specified, but function has no return statement
 36 | ERROR   | [ ] Type hint "array" missing for $output
 44 | WARNING | [x] A comma should follow the last multiline array item. Found: )
 60 | ERROR   | [ ] Type hint "array" missing for $output
---------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/contrib10/drupal10/modules/contrib/workbench/README.md
-------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
-------------------------------------------------------------------------------------------------
 160 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
 165 | WARNING | [ ] Line exceeds 80 characters; contains 159 characters
 168 | WARNING | [ ] Line exceeds 80 characters; contains 125 characters
 187 | ERROR   | [x] Expected 1 newline at end of file; 2 found
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/contrib10/drupal10/modules/contrib/workbench/src/Form/WorkbenchSettingsForm.php
--------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
  2 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
 82 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/contrib10/drupal10/modules/contrib/workbench/src/Plugin/Block/WorkbenchBlock.php
---------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------
 23 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/contrib10/drupal10/modules/contrib/workbench/src/Controller/WorkbenchContentController.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 3 WARNINGS AFFECTING 8 LINES
-------------------------------------------------------------------------------------------------------------------------------------
   7 | WARNING | [x] Unused use statement
   8 | WARNING | [x] Unused use statement
  21 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4 spaces
  40 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4 spaces
  81 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4 spaces
 110 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4 spaces
 132 | ERROR   | [ ] Missing parameter type
 140 | WARNING | [ ] Unused variable $key.
-------------------------------------------------------------------------------------------------------------------------------------

Steps to reproduce

phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml /Users/sahil.goyal/Documents/MySites/contrib10/drupal10/modules/contrib/workbench

Proposed resolution

Fixing phpcs errors.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India sahil.goyal

Live updates comments and jobs are added and updated live.
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.

Production build 0.71.5 2024