Problem/Motivation
FILE: ...contrib/web/modules/contrib/views_fields_on_off/views_fields_on_off.module
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
10 | ERROR | [x] Use statements should be sorted alphabetically. The first
| | wrong one is Drupal\Core\Routing\RouteMatchInterface.
197 | ERROR | [x] Return type must not contain variable name "$params"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...ontrib/views_fields_on_off/src/Plugin/views/field/ViewsFieldsOnOffForm.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first
| | wrong one is Drupal\Core\Form\FormStateInterface.
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...ntrib/views_fields_on_off/src/Plugin/views/filter/ViewsFieldsOnOffForm.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------
79 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
142 | ERROR | [x] Expected 1 blank line after function; 0 found
143 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
Time: 113ms; Memory: 10MB
Steps to reproduce
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml "module_path"
Proposed resolution
Resolve the PHPCS issues.
Comments
Comment #2
shyam_bhattHere I am adding a solution patch to fix the above issue.
After applying the patch, run the below code:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml "module_path"It will resolve all the issues from phpcs. + Needs review.
Comment #3
shyam_bhattI think the maintainer can use phpcbf and resolve similar issues. Hence, I am closing this issue.