Fix the remaining Drupal PHPCS issues

Created on 12 June 2023, almost 2 years ago
Updated 5 February 2024, about 1 year ago

Problem/Motivation

We already fixed quite a lot of PHP CS issues in 📌 Drupal 9 & 10 compatibility and PHPCS fixes Fixed , but there are just too many. Fix the remaining issues here.

The issues:

FILE: /var/www/html/web/modules/custom/billwerk-3364479/src/BillwerkApi.php
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 56 ERRORS AND 9 WARNINGS AFFECTING 46 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
  26 | WARNING | [x] '@Todo Refactor re-usable part into an abstract base class in subman.module.' should match the format '@todo Fix problem X here.'
  27 | WARNING | [x] '@Todo Refactor this into a dedicated Drupal-independent composer project?' should match the format '@todo Fix problem X here.'
  33 | ERROR   | [x] Expected 1 space before "*"; 0 found
  33 | ERROR   | [x] Expected 1 space after "*"; 0 found
  52 | WARNING | [x] '@Todo Convert static properties to class constants.' should match the format '@todo Fix problem X here.'
  53 | ERROR   | [ ] Visibility must be declared on property "$oAuth"
  53 | ERROR   | [x] You must use "/**" style comments for a member variable comment
  53 | ERROR   | [x] Equals sign not aligned with surrounding assignments; expected 18 spaces but found 5 spaces
  54 | ERROR   | [ ] Visibility must be declared on property "$iteroBase"
  54 | ERROR   | [ ] Missing member variable doc comment
  54 | ERROR   | [x] Equals sign not aligned with surrounding assignments; expected 14 spaces but found 1 space
  55 | ERROR   | [ ] Visibility must be declared on property "$contractResource"
  55 | ERROR   | [ ] Missing member variable doc comment
  55 | ERROR   | [x] Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
  56 | ERROR   | [ ] Visibility must be declared on property "$customerResource"
  56 | ERROR   | [ ] Missing member variable doc comment
  56 | ERROR   | [x] Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
  57 | ERROR   | [ ] Visibility must be declared on property "$customerSearchResource"
  57 | ERROR   | [ ] Missing member variable doc comment
  58 | ERROR   | [ ] Visibility must be declared on property "$plansResource"
  58 | ERROR   | [ ] Missing member variable doc comment
  58 | ERROR   | [x] Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space
  59 | ERROR   | [ ] Visibility must be declared on property "$planVariantsResource"
  59 | ERROR   | [ ] Missing member variable doc comment
  59 | ERROR   | [x] Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
  60 | ERROR   | [ ] Class constants must be uppercase; expected RESPONSECACHENAME but found responseCacheName
  60 | ERROR   | [x] Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space
  72 | ERROR   | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
 108 | ERROR   | [x] Visibility must be declared on method "ensureAuthorization"
 123 | ERROR   | [x] Visibility must be declared on method "getAuthToken"
 142 | ERROR   | [x] Visibility must be declared on method "setAuthToken"
 146 | WARNING | [ ] Line exceeds 80 characters; contains 97 characters
 147 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
 157 | ERROR   | [ ] Missing parameter type
 165 | ERROR   | [x] Visibility must be declared on method "authorize"
 166 | ERROR   | [x] No space found before comment text; expected "// Get oauth token to access remote API." but found "//Get oauth token to access remote API."
 170 | WARNING | [x] '@Todo replace curl with Guzzle.' should match the format '@todo Fix problem X here.'
 172 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
 173 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
 174 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
 175 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
 176 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
 177 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
 177 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 178 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
 178 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 179 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
 180 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
 187 | WARNING | [ ] Line exceeds 80 characters; contains 98 characters
 189 | WARNING | [x] A comma should follow the last multiline array item. Found: )
 228 | ERROR   | [ ] Parameter $limit is not described in comment
 305 | ERROR   | [ ] Missing parameter type
 320 | ERROR   | [ ] Missing parameter type
 336 | ERROR   | [ ] Missing parameter type
 352 | ERROR   | [ ] Missing parameter type
 388 | WARNING | [x] '@Todo check whether other staus codes have to be considered ok:' should match the format '@todo Fix problem X here.'
 432 | ERROR   | [ ] Missing parameter type
 434 | ERROR   | [ ] Missing parameter type
 490 | ERROR   | [ ] Missing parameter comment
 490 | ERROR   | [ ] Missing parameter type
 491 | ERROR   | [ ] Missing parameter comment
 491 | ERROR   | [ ] Missing parameter type
 495 | ERROR   | [ ] Private method name "BillwerkApi::exit_on_error" is not in lowerCamel format
 521 | ERROR   | [ ] Description for the @return value is missing
 524 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 33 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/billwerk-3364479/src/BillwerkSyncInterface.php
----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
 7 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
----------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/billwerk-3364479/src/BillwerkSync.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------FOUND 34 ERRORS AND 10 WARNINGS AFFECTING 38 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  10 | WARNING | [x] Unused use statement
  15 | WARNING | [ ] Line exceeds 80 characters; contains 208 characters
  17 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
  49 | ERROR   | [x] Missing function doc comment
  80 | ERROR   | [x] @inheritdoc found. Did you mean {@inheritdoc}?
  92 | ERROR   | [ ] String concat is not required here; use a single string instead
  92 | ERROR   | [x] Concat operator must be surrounded by a single space
  92 | ERROR   | [x] Concat operator must be surrounded by a single space
  93 | ERROR   | [x] Concat operator must be surrounded by a single space
  94 | ERROR   | [x] Concat operator must be surrounded by a single space
  96 | ERROR   | [x] Space found before semicolon; expected "];" but found "]\n      ;"
 115 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 124 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 6
 125 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 6
 131 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 136 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 6
 137 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 6
 138 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 6
 139 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 6
 140 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 6
 141 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 6
 150 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 153 | WARNING | [x] '@Todo break out this case into a dedicated method.' should match the format '@todo Fix problem X here.'
 158 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 166 | ERROR   | [x] @inheritdoc found. Did you mean {@inheritdoc}?
 187 | WARNING | [x] '@Todo Clarify sensible default for dunning level.' should match the format '@todo Fix problem X here.'
 189 | ERROR   | [ ] The array declaration extends to column 103 (the limit is 80). The array content should be split up over multiple lines
 210 | ERROR   | [x] Concat operator must be surrounded by a single space
 210 | WARNING | [ ] Line exceeds 80 characters; contains 116 characters
 210 | ERROR   | [x] Comments may not appear after statements
 211 | WARNING | [ ] Line exceeds 80 characters; contains 106 characters
 211 | ERROR   | [x] Comments may not appear after statements
 228 | ERROR   | [x] @inheritdoc found. Did you mean {@inheritdoc}?
 235 | WARNING | [x] '@Todo as soon as Billwerk offers a search for specific fields, try to use that.' should match the format '@todo Fix problem X here.'
 236 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
 236 | ERROR   | [ ] Comment indentation error, expected only 1 spaces
 238 | ERROR   | [x] Expected 1 space before ":"; 0 found
 243 | ERROR   | [x] @inheritdoc found. Did you mean {@inheritdoc}?
 250 | ERROR   | [x] @inheritdoc found. Did you mean {@inheritdoc}?
 257 | ERROR   | [x] @inheritdoc found. Did you mean {@inheritdoc}?
 264 | ERROR   | [x] @inheritdoc found. Did you mean {@inheritdoc}?
 271 | ERROR   | [x] @inheritdoc found. Did you mean {@inheritdoc}?
 280 | ERROR   | [x] @inheritdoc found. Did you mean {@inheritdoc}?
 283 | WARNING | [x] '@Todo Add security check so that only a subscription that actually belongs to a subscriber is embedded.' should match the format '@todo Fix problem X    
     |         |     here.'
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------PHPCBF CAN FIX THE 36 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/custom/billwerk-3364479/src/BillwerkApiInterface.php
----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
 7 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
----------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/billwerk-3364479/billwerk.module
-------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------
 6 | ERROR | [x] Doc comment short description must be on the first line
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/billwerk-3364479/billwerk.info.yml
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------
 7 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
----------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/billwerk-3364479/modules/custom_billwerk/custom_billwerk.module
------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 1 WARNING AFFECTING 8 LINES
------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] Missing file doc comment
  6 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
  7 | WARNING | [ ] Line exceeds 80 characters; contains 106 characters
 16 | ERROR   | [x] Equals sign not aligned correctly; expected 1 space but found 2 spaces
 21 | ERROR   | [x] Expected 1 space between comma and "2"; 0 found
 21 | ERROR   | [x] Expected one space after the comma, 0 found
 35 | ERROR   | [ ] Missing parameter comment
 36 | ERROR   | [ ] Missing parameter comment
 38 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/billwerk-3364479/modules/custom_billwerk/src/CustomBillwerkSync.php
----------------------------------------------------------------------------------------------------------
FOUND 15 ERRORS AND 11 WARNINGS AFFECTING 24 LINES
----------------------------------------------------------------------------------------------------------
  11 | ERROR   | [x] Doc comment short description must end with a full stop
  21 | ERROR   | [x] @inheritdoc found. Did you mean {@inheritdoc}?
  34 | ERROR   | [x] list(...) is forbidden, use [...] instead.
  47 | WARNING | [ ] Line exceeds 80 characters; contains 96 characters
  49 | WARNING | [ ] Line exceeds 80 characters; contains 130 characters
  55 | ERROR   | [x] Expected 1 blank line after function; 2 found
  59 | ERROR   | [x] @inheritdoc found. Did you mean {@inheritdoc}?
  67 | WARNING | [ ] Line exceeds 80 characters; contains 101 characters
  76 | ERROR   | [x] @inheritdoc found. Did you mean {@inheritdoc}?
  78 | ERROR   | [x] Visibility must be declared on method "performAdditionalWebhookAction"
  81 | WARNING | [x] There must be no blank line following an inline comment
  81 | WARNING | [ ] There must be no blank line following an inline comment
 113 | ERROR   | [x] Case breaking statement indented incorrectly; expected 8 spaces, found 6
 120 | ERROR   | [x] Parameter comment must be on the next line
 122 | ERROR   | [ ] Description for the @return value must be on the next line
 124 | ERROR   | [x] Visibility must be declared on method "getTrialEndForUser"
 127 | WARNING | [ ] Line exceeds 80 characters; contains 101 characters
 138 | WARNING | [ ] Line exceeds 80 characters; contains 100 characters
 145 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
 158 | ERROR   | [x] Expected 1 blank line after function; 2 found
 164 | ERROR   | [ ] Missing parameter type
 164 | ERROR   | [x] Parameter comment must be on the next line
 166 | ERROR   | [x] Visibility must be declared on method "notifyUserOfTrialEnd"
 167 | WARNING | [ ] Line exceeds 80 characters; contains 132 characters
 168 | WARNING | [ ] Unused variable $sync_data.
 170 | WARNING | [ ] Line exceeds 80 characters; contains 113 characters
----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 14 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/billwerk-3364479/modules/custom_billwerk/src/CustomBillwerkServiceProvider.php
---------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
---------------------------------------------------------------------------------------------------------------------
  9 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
 10 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
 14 | ERROR | [x] Expected 3 space(s) before asterisk; 2 found
 15 | ERROR | [x] Expected 3 space(s) before asterisk; 2 found
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/billwerk-3364479/modules/custom_billwerk/custom_billwerk.info.yml
--------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------
 7 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
--------------------------------------------------------------------------------------------------------

Steps to reproduce

Proposed resolution

Fix the PHPCS issues.

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

🇩🇪Germany Grevil

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

Merge Requests

Comments & Activities

  • Issue created by @Grevil
  • Assigned to Grevil
  • 🇩🇪Germany Anybody Porta Westfalica

    @Grevil: Please fix, once it's time to ... :)

  • Assigned to arti_parmar
  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.2 & MySQL 8
    last update almost 2 years ago
    2 pass
  • 🇮🇳India arti_parmar

    Kindly review patch.

  • Status changed to Needs work almost 2 years ago
  • 🇩🇪Germany Grevil

    Please use an MR instead. Thanks!

  • Assigned to nitin_lama
  • Issue was unassigned.
  • Merge request !8#3366158 Fixing phpcs error. → (Open) created by nitin_lama
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.2 & MySQL 8
    last update almost 2 years ago
    2 fail
  • Status changed to RTBC almost 2 years ago
  • Status changed to Needs work almost 2 years ago
  • 🇮🇳India nitin_lama India

    Created MR8 for the change. Few errors/warning remaining.

    FILE: /home/system/Documents/contribution/subman-3366158/src/SubmanUtilities.php
    --------------------------------------------------------------------------------
    FOUND 4 ERRORS AFFECTING 4 LINES
    --------------------------------------------------------------------------------
     141 | ERROR | Type hint "array" missing for $context
     175 | ERROR | Type hint "value" missing for $values
     244 | ERROR | Type hint "null" missing for $user
     263 | ERROR | Type hint "value" missing for $value
    --------------------------------------------------------------------------------
    
    
    FILE: /home/system/Documents/contribution/subman-3366158/src/SubmanSync.php
    ------------------------------------------------------------------------------------------
    FOUND 16 ERRORS AFFECTING 14 LINES
    ------------------------------------------------------------------------------------------
      225 | ERROR | Type hint "array" missing for $data
      225 | ERROR | Type hint "\Drupal\Core\Entity\ContentEntityBase" missing for $subscriber
      305 | ERROR | Type hint "array" missing for $log_data
      335 | ERROR | Type hint "id_primary" missing for $id_primary
      357 | ERROR | Type hint "array" missing for $data
      405 | ERROR | Type hint "array" missing for $data
      426 | ERROR | Type hint "array" missing for $data
      563 | ERROR | Type hint "array" missing for $data
      692 | ERROR | Type hint "null" missing for $user
      999 | ERROR | Type hint "array" missing for $data
     1037 | ERROR | Type hint "array" missing for $data
     1055 | ERROR | Type hint "data" missing for $data
     1148 | ERROR | Type hint "\Drupal\user\Entity\User" missing for $user
     1199 | ERROR | Type hint "\Drupal\user\Entity\User" missing for $user
     1220 | ERROR | Type hint "array" missing for $event
     1220 | ERROR | Type hint "\Drupal\user\Entity\User" missing for $user
    ------------------------------------------------------------------------------------------
    
    
    FILE: /home/system/Documents/contribution/subman-3366158/src/Plugin/Action/SubmanNotifyTrialEndApproaching.php
    --------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------
     44 | ERROR | Type hint "subman_sync" missing for $subman_sync
    --------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/system/Documents/contribution/subman-3366158/src/Event/SubmanSubscriberModified.php
    -----------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------
     40 | ERROR | Type hint "\Drupal\Core\Entity\ContentEntityBase" missing for $subscriber
    -----------------------------------------------------------------------------------------------
    
    Time: 190ms; Memory: 14MB
    
    
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.2 & MySQL 8
    last update almost 2 years ago
    2 fail
  • 🇮🇳India nitin_lama India

    Erros/Warning remaining.

    FILE: /home/system/Documents/contribution/subman-3366158/src/SubmanUtilities.php
    --------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    --------------------------------------------------------------------------------
     175 | ERROR | Type hint "value" missing for $values
     244 | ERROR | Type hint "null" missing for $user
     263 | ERROR | Type hint "value" missing for $value
    --------------------------------------------------------------------------------
    
    
    FILE: /home/system/Documents/contribution/subman-3366158/src/SubmanSync.php
    ---------------------------------------------------------------------------
    FOUND 10 ERRORS AFFECTING 10 LINES
    ---------------------------------------------------------------------------
      305 | ERROR | Type hint "array" missing for $log_data
      335 | ERROR | Type hint "id_primary" missing for $id_primary
      357 | ERROR | Type hint "array" missing for $data
      405 | ERROR | Type hint "array" missing for $data
      426 | ERROR | Type hint "array" missing for $data
      563 | ERROR | Type hint "array" missing for $data
      692 | ERROR | Type hint "null" missing for $user
     1037 | ERROR | Type hint "array" missing for $data
     1055 | ERROR | Type hint "data" missing for $data
     1220 | ERROR | Type hint "array" missing for $event
    ---------------------------------------------------------------------------
    
    
    FILE: /home/system/Documents/contribution/subman-3366158/src/Plugin/Action/SubmanNotifyTrialEndApproaching.php
    --------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------
     44 | ERROR | Type hint "subman_sync" missing for $subman_sync
    --------------------------------------------------------------------------------------------------------------
    
    Time: 192ms; Memory: 14MB
    
    
  • Merge request !10phpcbf fixes → (Merged) created by Anybody
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.4 + Environment: PHP 8.2 & MySQL 8
    last update over 1 year ago
    2 fail
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.4 + Environment: PHP 8.2 & MySQL 8
    last update over 1 year ago
    2 fail
  • 🇩🇪Germany Anybody Porta Westfalica

    @nitin_lama thanks for your work here! MR!8 needs to be rebased and finished, are you planning to do this?

  • Assigned to nitin_lama
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.4 + Environment: PHP 8.2 & MySQL 8
    last update over 1 year ago
    2 fail
  • Issue was unassigned.
  • 🇮🇳India nitin_lama India

    Rebased. Test failing.

  • Status changed to Closed: won't fix about 1 year ago
  • 🇩🇪Germany Anybody Porta Westfalica

    Canceled. See 📌 Set back to state if alpha2 Active for details.

Production build 0.71.5 2024