Coding Standard phpcs

Created on 21 November 2022, about 2 years ago
Updated 20 June 2024, 6 months ago

Problem/Motivation


FILE: ...includes/views/handlers/taxonomy_entity_index_handler_filter_tid_depth.inc
--------------------------------------------------------------------------------
FOUND 13 ERRORS AND 1 WARNING AFFECTING 8 LINES
--------------------------------------------------------------------------------
  1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
  5 | ERROR   | [ ] Class name must begin with a capital letter
  5 | ERROR   | [ ] Class name must use UpperCamel naming without underscores
  7 | ERROR   | [x] Visibility must be declared on method "init"
  7 | ERROR   | [x] Missing function doc comment
 12 | ERROR   | [x] Visibility must be declared on method "extra_options_form"
 12 | ERROR   | [ ] Method name
    |         |     "taxonomy_entity_index_handler_filter_tid_depth::extra_options_form"
    |         |     is not in lowerCamel format
 12 | ERROR   | [x] Missing function doc comment
 17 | ERROR   | [x] Visibility must be declared on method "query"
 17 | ERROR   | [x] Missing function doc comment
 30 | WARNING | [ ] Line exceeds 80 characters; contains 98 characters
 30 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment"
    |         |     instead
 77 | ERROR   | [x] Expected 1 blank line after function; 0 found
 78 | ERROR   | [x] The closing brace for the class must have an empty line
    |         |     before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ..._index/includes/views/handlers/taxonomy_entity_index_handler_field_tid.inc
--------------------------------------------------------------------------------
FOUND 20 ERRORS AFFECTING 10 LINES
--------------------------------------------------------------------------------
  8 | ERROR | [ ] Class name must begin with a capital letter
  8 | ERROR | [ ] Class name must use UpperCamel naming without underscores
  8 | ERROR | [x] Missing class doc comment
 11 | ERROR | [ ] Missing @var tag in member variable comment
 13 | ERROR | [ ] Class property $base_table_info should use lowerCamel naming
    |       |     without underscores
 13 | ERROR | [x] The var keyword must not be used to declare a property
 13 | ERROR | [ ] Visibility must be declared on property "$base_table_info"
 17 | ERROR | [ ] Missing @var tag in member variable comment
 18 | ERROR | [ ] Class property $entity_get_info should use lowerCamel naming
    |       |     without underscores
 18 | ERROR | [x] The var keyword must not be used to declare a property
 18 | ERROR | [ ] Visibility must be declared on property "$entity_get_info"
 21 | ERROR | [x] Visibility must be declared on method "init"
 21 | ERROR | [x] Missing function doc comment
 21 | ERROR | [x] Expected 1 blank line before function; 2 found
 28 | ERROR | [ ] The array declaration extends to column 146 (the limit is
    |       |     80). The array content should be split up over multiple lines
 31 | ERROR | [x] Visibility must be declared on method "pre_render"
 31 | ERROR | [ ] Method name
    |       |     "taxonomy_entity_index_handler_field_tid::pre_render" is not
    |       |     in lowerCamel format
 31 | ERROR | [x] Missing function doc comment
 73 | ERROR | [x] Expected 1 blank line after function; 0 found
 74 | ERROR | [x] The closing brace for the class must have an empty line
    |       |     before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...cludes/views/handlers/taxonomy_entity_index_handler_argument_tid_depth.inc
--------------------------------------------------------------------------------
FOUND 10 ERRORS AFFECTING 6 LINES
--------------------------------------------------------------------------------
  8 | ERROR | [ ] Class name must begin with a capital letter
  8 | ERROR | [ ] Class name must use UpperCamel naming without underscores
  8 | ERROR | [x] Missing class doc comment
 10 | ERROR | [x] Visibility must be declared on method "init"
 10 | ERROR | [x] Missing function doc comment
 13 | ERROR | [x] Expected 1 blank line after function; 2 found
 16 | ERROR | [x] Visibility must be declared on method "query"
 16 | ERROR | [x] Missing function doc comment
 69 | ERROR | [x] Expected 1 blank line after function; 0 found
 70 | ERROR | [x] The closing brace for the class must have an empty line
    |       |     before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...dules/taxonomy_entity_index/includes/views/taxonomy_entity_index.views.inc
--------------------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------
  1 | ERROR | [x] Missing file doc comment
  8 | ERROR | [x] Equals sign not aligned with surrounding assignments;
    |       |     expected 1 space but found 2 spaces
  9 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
 62 | ERROR | [x] Inline comments must start with a capital letter
 62 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
    |       |     question marks, colons, or closing parentheses
 67 | ERROR | [x] Inline comments must start with a capital letter
 67 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
    |       |     question marks, colons, or closing parentheses
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...ml/drupal8/web/modules/taxonomy_entity_index/taxonomy_entity_index.install
--------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------
   1 | ERROR | [x] Missing file doc comment
  58 | ERROR | [ ] The array declaration extends to column 92 (the limit is
     |       |     80). The array content should be split up over multiple
     |       |     lines
 112 | ERROR | [ ] The array declaration extends to column 117 (the limit is
     |       |     80). The array content should be split up over multiple
     |       |     lines
 129 | ERROR | [ ] The array declaration extends to column 102 (the limit is
     |       |     80). The array content should be split up over multiple
     |       |     lines
 155 | ERROR | [ ] The array declaration extends to column 117 (the limit is
     |       |     80). The array content should be split up over multiple
     |       |     lines
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...drupal8/web/modules/taxonomy_entity_index/taxonomy_entity_index.tokens.inc
--------------------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 4 LINES
--------------------------------------------------------------------------------
 57 | WARNING | [ ] Unused variable $sanitize.
 83 | ERROR   | [x] Missing function doc comment
 84 | ERROR   | [x] list(...) is forbidden, use [...] instead.
 89 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: .../drupal8/web/modules/taxonomy_entity_index/taxonomy_entity_index.admin.inc
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
  1 | ERROR | [x] Missing file doc comment
 38 | ERROR | [ ] The array declaration extends to column 84 (the limit is 80).
    |       |     The array content should be split up over multiple lines
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...tml/drupal8/web/modules/taxonomy_entity_index/taxonomy_entity_index.module
--------------------------------------------------------------------------------
FOUND 13 ERRORS AND 1 WARNING AFFECTING 13 LINES
--------------------------------------------------------------------------------
   1 | ERROR   | [x] Missing file doc comment
  34 | ERROR   | [x] list(...) is forbidden, use [...] instead.
  45 | ERROR   | [x] list(...) is forbidden, use [...] instead.
  94 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
  97 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 115 | ERROR   | [x] list(...) is forbidden, use [...] instead.
 142 | ERROR   | [x] Expected 1 space(s) after cast statement; 0 found
 176 | ERROR   | [ ] The array declaration extends to column 109 (the limit is
     |         |     80). The array content should be split up over multiple
     |         |     lines
 249 | ERROR   | [ ] The array declaration extends to column 126 (the limit is
     |         |     80). The array content should be split up over multiple
     |         |     lines
 273 | WARNING | [ ] Unused variable $error_operation.
 294 | ERROR   | [ ] Missing parameter type
 298 | ERROR   | [ ] Parameter tags must be grouped together in a doc comment
 298 | ERROR   | [ ] Missing parameter type
 302 | ERROR   | [ ] Return type missing for @return tag in function comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: .../drupal8/web/modules/taxonomy_entity_index/taxonomy_entity_index.drush.inc
--------------------------------------------------------------------------------
FOUND 5 ERRORS AND 1 WARNING AFFECTING 6 LINES
--------------------------------------------------------------------------------
  1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
  4 | ERROR   | [x] Doc comment short description must end with a full stop
  8 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements
    |         |     hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
    |         |     hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "*
    |         |     Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or
    |         |     "* Implements hook_foo_BAR_ID_bar() for block templates."
 12 | ERROR   | [ ] Return type missing for @return tag in function comment
 36 | ERROR   | [x] Expected 1 space after FOREACH keyword; 0 found
 37 | ERROR   | [ ] The array declaration extends to column 84 (the limit is
    |         |     80). The array content should be split up over multiple
    |         |     lines
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

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.

  • 🇮🇳India dev16.addweb

    Fixed the mentioned issues which are reported by phpcs.

    FILE: /home/addweb/patches/coffee/tests/src/Kernel/CoffeeCommandsTest.php
    -----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    -----------------------------------------------------------------------------------------------------------------------------------------
     65 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     71 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
    -----------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/addweb/patches/coffee/tests/src/Functional/CoffeeTest.php
    -----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    -----------------------------------------------------------------------------------------------------------------------------------------
     79 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     80 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
    -----------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/addweb/patches/coffee/tests/modules/coffee_test/src/Controller/CoffeeTestController.php
    ---------------------------------------------------------------------------------------------------
    FOUND 4 ERRORS AFFECTING 4 LINES
    ---------------------------------------------------------------------------------------------------
      8 | ERROR | [x] Missing class doc comment
     10 | ERROR | [x] Missing function doc comment
     12 | ERROR | [x] Expected 1 blank line after function; 0 found
     13 | 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: /home/addweb/patches/coffee/tests/modules/coffee_test/coffee_test.routing.yml
    -----------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------
     6 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
    -----------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/addweb/patches/coffee/src/Form/CoffeeConfigurationForm.php
    --------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------
     79 | WARNING | Menu::loadMultiple calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/addweb/patches/coffee/src/Controller/CoffeeController.php
    -------------------------------------------------------------------------------
    FOUND 4 ERRORS AND 1 WARNING AFFECTING 3 LINES
    -------------------------------------------------------------------------------
      65 | ERROR   | [ ] Parameter $url_generator is not described in comment
      65 | ERROR   | [ ] Parameter $route_match is not described in comment
     136 | ERROR   | [x] Expected newline after closing brace
     136 | ERROR   | [x] Expected 1 space after CATCH keyword; 0 found
     213 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
    -------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------
    
    
    FILE: /home/addweb/patches/coffee/coffee.module
    ----------------------------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    ----------------------------------------------------------------------------------------------------------------------------------
     10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Routing\RouteMatchInterface.
     41 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     44 | ERROR | [x] Expected 1 space after "="; 2 found
    ----------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------
    
    Time: 273ms; Memory: 10MB
    
    
  • Status changed to RTBC 6 months ago
  • 🇮🇳India vinmayiswamy

    Hi Silvi Sanghavi , thanks for the patch.

    I've tested coffee-3322818-5.patch on Drupal 10.2.x
    The patch is applied Cleanly...

    Test Result:
    The phpcs issues were fixed after the updated changes.

    RTBC+1

    Thanks!

  • 🇫🇷France dqd London | N.Y.C | Paris | Hamburg | Berlin

    Needs probably a reroll or MR ready to merge into 📌 Automated Drupal 11 compatibility fixes for coffee RTBC . But please be careful, it seems some of it has already been fixed over there.

  • 🇫🇷France dqd London | N.Y.C | Paris | Hamburg | Berlin
Production build 0.71.5 2024