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.

CommentFileSizeAuthor
#2 3401737-2.patch2.22 KBshyam_bhatt

Comments

Shyam_Bhatt created an issue. See original summary.

shyam_bhatt’s picture

Assigned: shyam_bhatt » Unassigned
Status: Active » Needs review
StatusFileSize
new2.22 KB

Here 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.

shyam_bhatt’s picture

Status: Needs review » Closed (works as designed)

I think the maintainer can use phpcbf and resolve similar issues. Hence, I am closing this issue.