Fix the issues reported by phpcs

Created on 15 November 2023, about 1 year ago
Updated 20 November 2023, about 1 year ago

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.

📌 Task
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

🇮🇳India shyam_bhatt Gujarat

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 @shyam_bhatt
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • 🇮🇳India shyam_bhatt Gujarat

    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.

  • Status changed to Closed: works as designed about 1 year ago
  • 🇮🇳India shyam_bhatt Gujarat

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

Production build 0.71.5 2024