Fix the errors/warnings reported by PHP_CodeSniffer

Created on 25 January 2024, 10 months ago
Updated 9 April 2024, 8 months ago

Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml shows the following errors/warnings which should be fixed.

FILE: ./README.md
----------------------------------------------------------------------
FOUND 1 ERROR AND 5 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------
 15 | WARNING | [ ] Line exceeds 80 characters; contains 92
    |         |     characters
 19 | WARNING | [ ] Line exceeds 80 characters; contains 111
    |         |     characters
 25 | WARNING | [ ] Line exceeds 80 characters; contains 111
    |         |     characters
 27 | WARNING | [ ] Line exceeds 80 characters; contains 94
    |         |     characters
 29 | WARNING | [ ] Line exceeds 80 characters; contains 83
    |         |     characters
 29 | ERROR   | [x] Expected 1 newline at end of file; 3 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./popin.module
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 1 | ERROR | [x] Missing file doc comment
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./src/Form/PopinConfigForm.php
----------------------------------------------------------------------
FOUND 8 ERRORS AND 4 WARNINGS AFFECTING 11 LINES
----------------------------------------------------------------------
   9 | ERROR   | [x] Use statements should be sorted alphabetically.
     |         |     The first wrong one is
     |         |     Drupal\Core\Config\ConfigFactoryInterface.
  14 | WARNING | [x] Unused use statement
  18 | WARNING | [ ] The class short comment should describe what the
     |         |     class does and not simply repeat the class name
  21 | ERROR   | [ ] Missing short description in doc comment
  22 | ERROR   | [x] Data types in @var tags need to be fully
     |         |     namespaced
  22 | ERROR   | [x] Data types in @var tags need to be fully
     |         |     namespaced
  26 | ERROR   | [ ] Missing short description in doc comment
  27 | ERROR   | [x] Data types in @var tags need to be fully
     |         |     namespaced
  40 | ERROR   | [x] Missing function doc comment
 160 | WARNING | [ ] Possible useless method overriding detected
 170 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 171 | WARNING | [ ] File::load calls should be avoided in classes,
     |         |     use dependency injection instead
----------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./src/Plugin/Block/PopinBlock.php
----------------------------------------------------------------------
FOUND 5 ERRORS AND 5 WARNINGS AFFECTING 9 LINES
----------------------------------------------------------------------
 11 | ERROR   | [x] Use statements should be sorted alphabetically.
    |         |     The first wrong one is
    |         |     Drupal\Core\Plugin\ContainerFactoryPluginInterface.
 12 | WARNING | [x] Unused use statement
 13 | WARNING | [x] Unused use statement
 14 | WARNING | [x] Unused use statement
 24 | ERROR   | [x] Expected 1 space before opening brace; found 2
 26 | ERROR   | [ ] Missing short description in doc comment
 31 | ERROR   | [ ] Parameter $config_factory is not described in
    |         |     comment
 44 | ERROR   | [x] Expected 1 blank line after function; 0 found
 85 | WARNING | [ ] ImageStyle::load calls should be avoided in
    |         |     classes, use dependency injection instead
 85 | WARNING | [ ] File::load calls should be avoided in classes,
    |         |     use dependency injection instead
----------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 100ms; Memory: 6MB
๐Ÿ“Œ Task
Status

Fixed

Version

2.1

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024