Fix the issues reported by PHP_CodeSniffer

Created on 23 September 2024, 3 months ago

Problem/Motivation

FILE: headline_group\headline_group.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------

FILE: headline_group\headline_group.module
--------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 1 WARNING AFFECTING 5 LINES
--------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
8 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
30 | ERROR | [x] Use "elseif" in place of "else if"
36 | ERROR | [x] Expected one space after the comma, 0 found
37 | WARNING | [x] A comma should follow the last multiline array item. Found: ' https://www.drupal.org/project/headline_group → '
--------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------

FILE: headline_group\headline_group.tokens.inc
-------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 1 WARNING AFFECTING 7 LINES
-------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
15 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
34 | ERROR | [x] Whitespace found at end of line
49 | ERROR | [x] Case breaking statements must be followed by a single blank line
52 | ERROR | [x] Case breaking statements must be followed by a single blank line
58 | ERROR | [x] Whitespace found at end of line
61 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------

FILE: headline_group\src\HeadlineGroupItemInterface.php
------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------
18 | WARNING | Line exceeds 80 characters; contains 82 characters
------------------------------------------------------------------------------------------

FILE: headline_group\src\Plugin\Field\FieldFormatter\HeadlineDefaultFormatter.php
----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldItemListInterface.
----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------

FILE: headline_group\src\Plugin\Field\FieldType\HeadlineGroupItem.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldItemBase.
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------

FILE: headline_group\src\Plugin\Field\FieldWidget\BaseHeadlineWidget.php
----------------------------------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 1 WARNING AFFECTING 6 LINES
----------------------------------------------------------------------------------------------------------------------------------------
6 | WARNING | [x] Unused use statement
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldDefinitionInterface.
14 | ERROR | [x] Missing class doc comment
22 | ERROR | [x] Use null coalesce operator instead of ternary operator.
22 | ERROR | [x] Expected 1 space before "?"; 0 found
23 | ERROR | [x] Use null coalesce operator instead of ternary operator.
66 | ERROR | [x] Inline comments must start with a capital letter
66 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
150 | ERROR | [x] Expected 1 space before "="; 0 found
----------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------

FILE: headline_group\src\Plugin\Field\FieldWidget\HeadlineCompleteWidget.php
---------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
---------------------------------------------------------------------------------------------------------------
30 | ERROR | [x] Use null coalesce operator instead of ternary operator.
42 | ERROR | [x] Use null coalesce operator instead of ternary operator.
53 | ERROR | [x] Expected 1 blank line after function; 0 found
54 | ERROR | [x] The closing brace for the class must have an empty line before it
---------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------

FILE: headline_group\src\Plugin\Field\FieldWidget\HeadlineHeadlineOnlyWidget.php
-------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------
16 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------

Steps to reproduce

Run phpcs command to get the drupal coding standard issues.

Proposed resolution

Many of the issues can be fixed by running the phpcbf command. For the remaining ones, we will need to manually address and then commit these changes before pushing them.

📌 Task
Status

Needs work

Version

1.0

Component

Code

Created by

🇺🇸United States sunil jolapara 3265 Summitrun Drive, Independence, KY, 41051

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