Drupal Coding Standards Issues | phpcs

Created on 20 January 2023, almost 2 years ago
Updated 10 July 2024, 6 months ago

Problem/Motivation

Getting Following errors/warnings

$ phpcs --standard=Drupal search_api_solr_boosted_keyword

FILE: ...esktop\task\search_api_solr_boosted_keyword\src\BoostedKeywordsManager.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found
    |       |     "\r\n"
 77 | ERROR | [ ] Parameter $filters is not described in comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...k\search_api_solr_boosted_keyword\src\Form\BoostedKeywordsOverviewForm.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
--------------------------------------------------------------------------------


FILE: ...d\src\Plugin\Field\FieldFormatter\SearchApiSolrBoostedKeywordFormatter.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
--------------------------------------------------------------------------------


FILE: ...boosted_keyword\src\Plugin\Field\FieldType\SearchApiSolrBoostedKeyword.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
--------------------------------------------------------------------------------


FILE: ...keyword\src\Plugin\Field\FieldWidget\SearchApiSolrBoostedKeywordWidget.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found
    |       |     "\r\n"
 38 | ERROR | [x] Use null coalesce operator instead of ternary operator.
 48 | ERROR | [x] Use null coalesce operator instead of ternary operator.
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 495ms; Memory: 10MB

Proposed resolution

Fix the errors and warnings.

🐛 Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

🇮🇳India jay jangid Jaipur

Live updates comments and jobs are added and updated live.
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.

  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India riddhi.addweb

    After I applied the Patch [MR10], I found some PHPCS errors. Please review it from your end once. These are the errors which were found:-

    FILE: /var/www/html/web/drupal10/web/modules/contrib/search_api_solr_boosted_keyword/src/Form/BoostedKeywordsOverviewForm.php
    ---------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------
    6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\EntityTypeManagerInterface.
    ---------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------

    FILE: /var/www/html/web/drupal10/web/modules/contrib/search_api_solr_boosted_keyword/search_api_solr_boosted_keyword.module
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 32 ERRORS AND 10 WARNINGS AFFECTING 26 LINES
    -------------------------------------------------------------------------------------------------------------------------------
    10 | WARNING | [x] Unused use statement
    11 | WARNING | [x] Unused use statement
    11 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\search_api\Item\Item.
    17 | WARNING | [ ] Line exceeds 80 characters; contains 107 characters
    18 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
    25 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
    25 | ERROR | [x] The closing parenthesis of a multi-line function declaration must be on a new line
    34 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
    34 | ERROR | [x] Opening brace must be the last content on the line
    34 | ERROR | [x] There should be no white space after an opening "{"
    34 | ERROR | [x] There should be no white space before a closing "}"
    34 | ERROR | [x] Closing brace must be on a line by itself
    34 | ERROR | [x] Each PHP statement must be on a line by itself
    53 | ERROR | [x] Data types in @var tags need to be fully namespaced
    59 | ERROR | [x] Data types in @var tags need to be fully namespaced
    62 | ERROR | [x] Data types in @var tags need to be fully namespaced
    83 | WARNING | [ ] Line exceeds 80 characters; contains 117 characters
    84 | WARNING | [ ] Line exceeds 80 characters; contains 103 characters
    84 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
    86 | ERROR | [ ] Missing parameter comment
    86 | ERROR | [ ] Missing parameter type
    87 | ERROR | [ ] Missing parameter comment
    87 | ERROR | [ ] Missing parameter type
    89 | ERROR | [ ] Description for the @return value is missing
    94 | WARNING | [ ] Unused variable $delta.
    114 | WARNING | [ ] Line exceeds 80 characters; contains 119 characters
    115 | WARNING | [ ] Line exceeds 80 characters; contains 118 characters
    116 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
    121 | ERROR | [ ] Namespaced classes/interfaces/traits should be referenced with use statements
    122 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
    122 | ERROR | [x] The closing parenthesis of a multi-line function declaration must be on a new line
    129 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
    131 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
    131 | ERROR | [x] Opening brace must be the last content on the line
    131 | ERROR | [x] There should be no white space after an opening "{"
    131 | ERROR | [x] There should be no white space before a closing "}"
    131 | ERROR | [x] Closing brace must be on a line by itself
    131 | ERROR | [x] Each PHP statement must be on a line by itself
    163 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
    171 | WARNING | [ ] Line exceeds 80 characters; contains 112 characters
    180 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
    181 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
    -------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 25 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------

    FILE: /var/www/html/web/drupal10/web/modules/contrib/search_api_solr_boosted_keyword/README.md
    ----------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 7 WARNINGS AFFECTING 7 LINES
    ----------------------------------------------------------------------------------------------
    11 | WARNING | Line exceeds 80 characters; contains 89 characters
    15 | WARNING | Line exceeds 80 characters; contains 116 characters
    18 | WARNING | Line exceeds 80 characters; contains 107 characters
    31 | WARNING | Line exceeds 80 characters; contains 87 characters
    35 | WARNING | Line exceeds 80 characters; contains 93 characters
    36 | WARNING | Line exceeds 80 characters; contains 87 characters
    37 | WARNING | Line exceeds 80 characters; contains 90 characters
    ----------------------------------------------------------------------------------------------

  • Status changed to Needs work 6 months ago
Production build 0.71.5 2024