Drupal Coding Standards Issues | phpcs

Created on 30 January 2023, over 1 year ago

Problem/Motivation

Getting Following errors/warning

$ phpcs --standard=Drupal existing_values_autocomplete_widget

FILE: ...sting_values_autocomplete_widget\src\Controller\AutocompleteController.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 3 WARNINGS AFFECTING 5 LINES
--------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
    |         |     "\r\n"
  9 | WARNING | [x] Unused use statement
 13 | WARNING | [ ] The class short comment should describe what the class does
    |         |     and not simply repeat the class name
 21 | ERROR   | [x] Expected 1 blank line before function; 0 found
 27 | WARNING | [ ] Line exceeds 80 characters; contains 90 characters
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...te_widget\src\Plugin\Field\FieldWidget\ExistingAutocompleteFieldWidget.php
--------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found
    |       |     "\r\n"
 83 | ERROR | [x] Use null coalesce operator instead of ternary operator.
 88 | ERROR | [ ] The array declaration extends to column 202 (the limit is
    |       |     80). The array content should be split up over multiple lines
 88 | ERROR | [x] Short array syntax must be used to define arrays
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...task\existing_values_autocomplete_widget\tests\src\Functional\LoadTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found
   |       |     "\r\n"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 460ms; Memory: 8MB

Proposed resolution

Fix the errors and warnings.

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇮🇳India Jay Jangid

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

Comments & Activities

Production build 0.69.0 2024