Fix the warnings/errors reported by PHP_CodeSniffer

Created on 7 July 2023, over 1 year ago
Updated 21 August 2024, 3 months ago

Problem/Motivation

FILE: /home/lenovo/d7to9/web/modules/contrib/webform_newsletter2go/src/Plugin/WebformHandler/DoubleOptInHandler.php
-------------------------------------------------------------------------------------------------------------------
FOUND 14 ERRORS AND 9 WARNINGS AFFECTING 23 LINES
-------------------------------------------------------------------------------------------------------------------
   5 | WARNING | [x] Unused use statement
   6 | WARNING | [x] Unused use statement
   7 | WARNING | [x] Unused use statement
   9 | WARNING | [x] Unused use statement
  10 | WARNING | [x] Unused use statement
  12 | WARNING | [x] Unused use statement
  13 | WARNING | [x] Unused use statement
  15 | WARNING | [x] Unused use statement
  16 | WARNING | [x] Unused use statement
  88 | ERROR   | [x] Expected 1 blank line before function; 2 found
  90 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  92 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  93 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  94 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  95 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  96 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  97 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  98 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  99 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 100 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 101 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 103 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 105 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
-------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 23 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/webform_newsletter2go/src/Form/Newsletter2GoForm.php
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
 12 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
-----------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/webform_newsletter2go/src/PostManager.php
--------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactory.
--------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/webform_newsletter2go/src/PostManagerInterface.php
----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
 9 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
----------------------------------------------------------------------------------------------------------------

Time: 123ms; Memory: 10MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig webform_newsletter2go/

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

RTBC

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India roshni27

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 @roshni27
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Status changed to RTBC 3 months ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @roshni27,

    I applied patch #2, it was applied smoothly and fixed the phpcs issues.

    āžœ  webform_newsletter2go git:(8.x-1.x) curl https://www.drupal.org/files/issues/2023-07-07/fixes-errors-phpcs-3373240-2.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  4275  100  4275    0     0  11101      0 --:--:-- --:--:-- --:--:-- 11132
    patching file src/Form/Newsletter2GoForm.php
    patching file src/Plugin/WebformHandler/DoubleOptInHandler.php
    patching file src/PostManager.php
    patching file src/PostManagerInterface.php
    āžœ  webform_newsletter2go git:(8.x-1.x) āœ— ..
    āžœ  contrib phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js webform_newsletter2go
    āžœ  contrib

    Thank you.

Production build 0.71.5 2024