Fix the errors/warnings reported by PHP_CodeSniffer

Created on 11 March 2021, over 3 years ago
Updated 26 March 2024, 8 months ago

Running shows the following errors/warnings, which should be fixed, when they are not false positive nor they suggest wrong changes.

FILE: ./default_paragraphs/default_paragraphs.module
-------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------
  1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
  7 | ERROR | [x] When importing a class with "use", do not include a leading \
 14 | ERROR | [x] There must be no space before the colon in a CASE statement
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------


FILE: ./default_paragraphs/src/Plugin/Field/FieldWidget/DefaultParagraphsWidget.php
-------------------------------------------------------------------------
FOUND 8 ERRORS AND 5 WARNINGS AFFECTING 12 LINES
-------------------------------------------------------------------------
  11 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is
     |         |     Drupal\Core\Field\FieldItemListInterface.
  57 | ERROR   | [ ] Parameter $token_service is not described in comment
  74 | ERROR   | [x] Doc comment parameter name "$token_service." must not end with a dot
 206 | ERROR   | [x] Expected one space after the comma, 2 found
 206 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 207 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 245 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 253 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 268 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 286 | WARNING | [ ] Unused variable $key.
 293 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         |     $this->t() instead
 295 | WARNING | [x] A comma should follow the last multiline array item. Found: $cardinality
 361 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------

Time: 186ms; Memory: 12MB
๐Ÿ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Sahana _N

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

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024