Drupal Coding Standards Issues | phpcs

Created on 31 January 2023, over 1 year ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/entityreference_extensions/entityreference_extensions.post_update.php
----------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------
37 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/entityreference_extensions/tests/src/Kernel/FormatterTestTrait.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------
28 | ERROR | The array declaration extends to column 90 (the limit is 80). The array content should be split up over multiple lines
-------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/entityreference_extensions/src/Plugin/Field/FieldFormatter/EntityReferenceEntityDeltaFormatter.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 9 ERRORS AND 7 WARNINGS AFFECTING 13 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
35 | WARNING | [x] A comma should follow the last multiline array item. Found: TRUE
46 | WARNING | [x] A comma should follow the last multiline array item. Found: )
53 | WARNING | [x] A comma should follow the last multiline array item. Found: )
58 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
59 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
65 | ERROR | [x] Doc comment short description must start with a capital letter
65 | ERROR | [x] Doc comment short description must end with a full stop
67 | ERROR | [ ] Missing parameter comment
67 | ERROR | [ ] Missing parameter type
68 | ERROR | [ ] Missing parameter comment
68 | ERROR | [ ] Missing parameter type
70 | ERROR | [ ] Description for the @return value is missing
72 | ERROR | [ ] Public method name "EntityReferenceEntityDeltaFormatter::different_display" is not in lowerCamel format
78 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
79 | ERROR | [x] Concat operator must be surrounded by a single space
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/entityreference_extensions/src/EntityReferenceDeltaFilterTrait.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
39 | WARNING | [x] A comma should follow the last multiline array item. Found: 'default'
40 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
91 | ERROR | [ ] The array declaration extends to column 276 (the limit is 80). The array content should be split up over multiple lines
325 | ERROR | [x] Use null coalesce operator instead of ternary operator.
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------

Time: 1.27 secs; Memory: 10MB

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/entityreference_extensions/

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

RTBC

Version

1.0

Component

Code

Created by

🇮🇳India samit.310@gmail.com

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

Production build 0.69.0 2024