Fix the errors/warnings reported by PHP_CodeSniffer

Created on 17 January 2024, 6 months ago
Updated 5 June 2024, 25 days ago

Problem/Motivation

When running the module code against Drupal coding standards based on Drupal standard, the module shows errors

Steps to reproduce

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

Report:

FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway/config/install/stripe_gateway.settings.yml
-----------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------
 10 | ERROR | [x] Expected 1 newline at end of file; 0 found
-----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway/stripe_gateway.routing.yml
----------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------
 15 | WARNING | [ ] Open page callback found, please add a comment before the line why there is no access restriction
 45 | ERROR   | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway/README.md
--------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 11 WARNINGS AFFECTING 11 LINES
--------------------------------------------------------------------------------------
  5 | WARNING | Line exceeds 80 characters; contains 117 characters
  6 | WARNING | Line exceeds 80 characters; contains 230 characters
 34 | WARNING | Line exceeds 80 characters; contains 97 characters
 39 | WARNING | Line exceeds 80 characters; contains 94 characters
 45 | WARNING | Line exceeds 80 characters; contains 101 characters
 48 | WARNING | Line exceeds 80 characters; contains 97 characters
 53 | WARNING | Line exceeds 80 characters; contains 103 characters
 73 | WARNING | Line exceeds 80 characters; contains 104 characters
 74 | WARNING | Line exceeds 80 characters; contains 123 characters
 81 | WARNING | Line exceeds 80 characters; contains 191 characters
 82 | WARNING | Line exceeds 80 characters; contains 159 characters
--------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway/stripe_gateway.links.menu.yml
----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------
 6 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway/src/Form/StripeFormSettings.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 35 ERRORS AND 2 WARNINGS AFFECTING 35 LINES
-------------------------------------------------------------------------------------------------------------------------------------------
   3 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
  13 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\EntityTypeManagerInterface.
  16 | ERROR   | [x] Missing class doc comment
  17 | ERROR   | [x] Opening brace should be on the same line as the declaration
  24 | ERROR   | [x] Expected 1 blank line before function; 0 found
  25 | ERROR   | [x] Opening brace should be on the same line as the declaration
  33 | ERROR   | [x] Opening brace should be on the same line as the declaration
  43 | ERROR   | [x] Opening brace should be on the same line as the declaration
  52 | ERROR   | [x] Opening brace should be on the same line as the declaration
  62 | ERROR   | [x] Opening brace should be on the same line as the declaration
  64 | WARNING | [ ] Unused variable $existingContentTypeOptions.
  71 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  79 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  87 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  95 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  97 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
 104 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 111 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 125 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 134 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 141 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 149 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 156 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 161 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 165 | ERROR   | [x] The first index in a multi-value array must be on a new line
 166 | ERROR   | [x] Array indentation error, expected 10 spaces but found 8
 167 | ERROR   | [x] Expected one space after the comma, 0 found
 167 | ERROR   | [x] Closing parenthesis of array declaration must be on a new line
 175 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 180 | ERROR   | [x] The first index in a multi-value array must be on a new line
 181 | ERROR   | [x] Expected one space after the comma, 0 found
 181 | ERROR   | [x] Closing parenthesis of array declaration must be on a new line
 186 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 196 | ERROR   | [x] Opening brace should be on the same line as the declaration
 199 | WARNING | [x] A comma should follow the last multiline array item. Found: 'invoice'
 218 | ERROR   | [x] Opening brace should be on the same line as the declaration
 225 | ERROR   | [x] Expected 1 blank line after function; 0 found
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 36 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway/src/Form/BtnPaySubscription.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 33 ERRORS AND 23 WARNINGS AFFECTING 51 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
   3 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
  15 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
  16 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
  18 | ERROR   | [x] Opening brace should be on the same line as the declaration
  22 | ERROR   | [x] Expected 1 blank line before function; 0 found
  23 | ERROR   | [x] Opening brace should be on the same line as the declaration
  31 | ERROR   | [x] Opening brace should be on the same line as the declaration
  32 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
  33 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  34 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  36 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
  38 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  39 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  43 | ERROR   | [x] Inline comments must start with a capital letter
  43 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  44 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
  47 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  51 | ERROR   | [x] Expected newline after closing brace
  54 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  57 | ERROR   | [x] Expected newline after closing brace
  59 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  61 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  70 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
  71 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  79 | ERROR   | [x] Whitespace found at end of line
  80 | ERROR   | [x] Inline comments must start with a capital letter
  80 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  81 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  82 | WARNING | [ ] Line exceeds 80 characters; contains 92 characters
  83 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  84 | WARNING | [ ] Line exceeds 80 characters; contains 90 characters
  87 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  88 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
  90 | ERROR   | [x] Whitespace found at end of line
  91 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  92 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  94 | ERROR   | [ ] Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  95 | WARNING | [ ] Line exceeds 80 characters; contains 92 characters
  96 | WARNING | [ ] Line exceeds 80 characters; contains 97 characters
  96 | ERROR   | [x] Whitespace found at end of line
  98 | WARNING | [ ] Line exceeds 80 characters; contains 97 characters
 103 | ERROR   | [x] Concat operator must be surrounded by a single space
 103 | ERROR   | [x] Concat operator must be surrounded by a single space
 112 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 114 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 118 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 120 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 121 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 123 | ERROR   | [x] Concat operator must be surrounded by a single space
 123 | ERROR   | [x] Concat operator must be surrounded by a single space
 124 | WARNING | [x] A comma should follow the last multiline array item. Found: 1
 126 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 127 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 128 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 130 | ERROR   | [x] Expected newline after closing brace
 131 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 35 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway/src/Form/StripeFormCancelSubscription.php
--------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 7 WARNINGS AFFECTING 11 LINES
--------------------------------------------------------------------------------------------------------------------------------------------------------
  7 | WARNING | [x] Unused use statement
  8 | WARNING | [x] Unused use statement
 26 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 27 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 28 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 35 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 55 | WARNING | [x] A comma should follow the last multiline array item. Found: 'ID sale'
 55 | WARNING | [ ] #description values usually have to run through t() for translation
 62 | ERROR   | [x] Expected newline after closing brace
 74 | ERROR   | [x] No space found before comment text; expected "// call the service for cancellation" but found "//call the service for cancellation"
 74 | ERROR   | [x] Inline comments must start with a capital letter
 74 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 75 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 79 | ERROR   | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway/src/Plugin/QueueWorker/StripeWebhookQueue.php
------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 19 ERRORS AND 1 WARNING AFFECTING 17 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------------
  3 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
  5 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
  6 | ERROR   | [ ] Doc comment short description must end with a full stop
  6 | ERROR   | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
 14 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\stripe_gateway\StripeServiceApi.
 26 | ERROR   | [x] Whitespace found at end of line
 58 | ERROR   | [x] Opening brace should be on the same line as the declaration
 65 | ERROR   | [x] Expected 1 space after SWITCH keyword; 0 found
 67 | ERROR   | [x] No space found before comment text; expected "// A billing subscription was cancelled" but found "//A billing subscription was
    |         |     cancelled"
 67 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 69 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 71 | ERROR   | [x] No space found before comment text; expected "// A payment completed" but found "//A payment completed"
 71 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 73 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 75 | ERROR   | [x] No space found before comment text; expected "// A customer subscription updated" but found "//A customer subscription updated"
 76 | ERROR   | [x] No space found before comment text; expected "// $this->apiService->subscriptionUpdated($entity_data);" but found
    |         |     "//$this->apiService->subscriptionUpdated($entity_data);"
 77 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 81 | ERROR   | [x] Expected newline after closing brace
 84 | ERROR   | [x] Expected 1 blank line after function; 0 found
 85 | ERROR   | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 17 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway/src/Plugin/Block/PaySubscriptionBlock.php
----------------------------------------------------------------------------------------------------------------------------
FOUND 9 ERRORS AND 4 WARNINGS AFFECTING 13 LINES
----------------------------------------------------------------------------------------------------------------------------
  3 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
  5 | ERROR   | [x] Doc comment short description must end with a full stop
 12 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Access\AccessResult.
 13 | WARNING | [x] Unused use statement
 24 | ERROR   | [x] Opening brace should be on the same line as the declaration
 28 | ERROR   | [x] Expected 1 blank line before function; 0 found
 29 | ERROR   | [x] Opening brace should be on the same line as the declaration
 30 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 31 | ERROR   | [x] Whitespace found at end of line
 42 | ERROR   | [x] Opening brace should be on the same line as the declaration
 44 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 49 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 59 | ERROR   | [x] Expected 1 blank line after function; 0 found
----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway/src/Controller/StripeWebhookController.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 22 ERRORS AND 9 WARNINGS AFFECTING 24 LINES
-------------------------------------------------------------------------------------------------------------------------------
   3 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
   5 | WARNING | [ ] Line exceeds 80 characters; contains 99 characters
  21 | ERROR   | [x] Opening brace should be on the same line as the declaration
  41 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
  43 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
  46 | ERROR   | [x] Opening brace should be on the same line as the declaration
  55 | ERROR   | [x] Opening brace should be on the same line as the declaration
  69 | ERROR   | [x] Opening brace should be on the same line as the declaration
  76 | ERROR   | [x] Whitespace found at end of line
  94 | ERROR   | [x] Opening brace should be on the same line as the declaration
  95 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  96 | ERROR   | [x] Expected 1 space after "="; 2 found
  96 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  97 | ERROR   | [x] Whitespace found at end of line
  98 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 100 | WARNING | [ ] Line exceeds 80 characters; contains 100 characters
 107 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 111 | WARNING | [ ] Unused variable $event.
 111 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 117 | ERROR   | [x] Expected newline after closing brace
 118 | ERROR   | [x] Inline comments must start with a capital letter
 118 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 119 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 119 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
 119 | ERROR   | [x] Concat operator must be surrounded by a single space
 120 | ERROR   | [x] Expected newline after closing brace
 120 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 121 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 122 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 122 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
 126 | ERROR   | [x] Whitespace found at end of line
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 22 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway/src/Controller/StripeCheckoutController.php
------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 91 ERRORS AND 55 WARNINGS AFFECTING 116 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------------
   3 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
   5 | ERROR   | [x] Doc comment short description must end with a full stop
   5 | ERROR   | [x] Whitespace found at end of line
  11 | WARNING | [x] Unused use statement
  14 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Url.
  18 | WARNING | [x] Unused use statement
  20 | WARNING | [x] Unused use statement
  22 | ERROR   | [x] Missing class doc comment
  23 | ERROR   | [x] Opening brace should be on the same line as the declaration
  24 | ERROR   | [x] Whitespace found at end of line
  42 | ERROR   | [ ] Missing parameter comment
  43 | ERROR   | [ ] Missing parameter comment
  44 | ERROR   | [x] There must be no blank lines after the function comment
  64 | ERROR   | [x] Expected 3 space(s) before asterisk; 2 found
  64 | ERROR   | [x] Additional blank lines found at end of doc comment
  68 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  71 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  72 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  78 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  79 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  87 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  91 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  93 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  97 | ERROR   | [x] Inline comments must start with a capital letter
  97 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  99 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
 100 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
 100 | WARNING | [x] There must be no blank line following an inline comment
 100 | WARNING | [ ] There must be no blank line following an inline comment
 101 | ERROR   | [x] Whitespace found at end of line
 102 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 106 | ERROR   | [x] Whitespace found at end of line
 109 | WARNING | [ ] Line exceeds 80 characters; contains 86 characters
 109 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 112 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 112 | WARNING | [ ] User::load calls should be avoided in classes, use dependency injection instead
 115 | ERROR   | [x] Expected newline after closing brace
 116 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 119 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 120 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 121 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 122 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 124 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 126 | ERROR   | [x] Expected newline after closing brace
 129 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 140 | ERROR   | [x] Whitespace found at end of line
 141 | ERROR   | [x] Expected newline after closing brace
 142 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 145 | ERROR   | [x] Line indented incorrectly; expected 14 spaces, found 16
 145 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 146 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 147 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 148 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 150 | ERROR   | [x] Whitespace found at end of line
 152 | ERROR   | [x] Short array syntax must be used to define arrays
 154 | ERROR   | [x] Whitespace found at end of line
 155 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 156 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 157 | ERROR   | [x] Short array syntax must be used to define arrays
 158 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 159 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 160 | ERROR   | [x] Expected newline after closing brace
 161 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 165 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 170 | ERROR   | [x] Whitespace found at end of line
 172 | ERROR   | [x] Whitespace found at end of line
 173 | ERROR   | [x] Expected newline after closing brace
 175 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 176 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 178 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 178 | WARNING | [ ] User::load calls should be avoided in classes, use dependency injection instead
 178 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 181 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 183 | ERROR   | [x] Expected newline after closing brace
 184 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 185 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 188 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 189 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 190 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 193 | ERROR   | [x] Whitespace found at end of line
 197 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 201 | WARNING | [ ] Line exceeds 80 characters; contains 86 characters
 202 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 214 | WARNING | [x] A comma should follow the last multiline array item. Found: 'id_role'
 218 | WARNING | [ ] Line exceeds 80 characters; contains 108 characters
 229 | WARNING | [x] A comma should follow the last multiline array item. Found: $newRole
 234 | ERROR   | [x] No space found before comment text; expected "// get the ppss_sales data inserted above" but found "//get the ppss_sales data inserted
     |         |     above"
 234 | ERROR   | [x] Inline comments must start with a capital letter
 234 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 235 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 240 | ERROR   | [x] Inline comments must start with a capital letter
 240 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 241 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 249 | WARNING | [x] A comma should follow the last multiline array item. Found: 0
 252 | ERROR   | [x] Whitespace found at end of line
 253 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 253 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 254 | ERROR   | [x] Expected newline after closing brace
 255 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 256 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 258 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 259 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 260 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 265 | ERROR   | [x] Expected newline after closing brace
 267 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 275 | ERROR   | [x] Additional blank lines found at end of doc comment
 277 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 277 | ERROR   | [x] Whitespace found at end of line
 278 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 279 | ERROR   | [x] Whitespace found at end of line
 280 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 281 | ERROR   | [x] Short array syntax must be used to define arrays
 287 | WARNING | [x] A comma should follow the last multiline array item. Found: ''
 290 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 291 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 293 | ERROR   | [x] Expected 1 space between comma and "'uid'"; 0 found
 293 | ERROR   | [x] Expected one space after the comma, 0 found
 293 | ERROR   | [x] Expected 1 space between comma and "'mail'"; 0 found
 293 | ERROR   | [x] Expected one space after the comma, 0 found
 293 | ERROR   | [x] Expected 1 space between comma and "'platform'"; 0 found
 293 | ERROR   | [x] Expected one space after the comma, 0 found
 293 | ERROR   | [x] Expected 1 space between comma and "'details'"; 0 found
 293 | ERROR   | [x] Expected one space after the comma, 0 found
 296 | ERROR   | [x] Short array syntax must be used to define arrays
 300 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 301 | ERROR   | [x] Concat operator must be surrounded by a single space
 301 | ERROR   | [x] Concat operator must be surrounded by a single space
 301 | ERROR   | [x] Concat operator must be surrounded by a single space
 301 | ERROR   | [x] Concat operator must be surrounded by a single space
 303 | ERROR   | [x] No space found before comment text; expected "// print the data from table" but found "//print the data from table"
 303 | ERROR   | [x] Inline comments must start with a capital letter
 303 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 304 | ERROR   | [x] Short array syntax must be used to define arrays
 310 | ERROR   | [x] Whitespace found at end of line
 311 | ERROR   | [x] Array indentation error, expected 8 spaces but found 22
 314 | ERROR   | [x] No space found before comment text; expected "// display data in site" but found "//display data in site"
 314 | ERROR   | [x] Inline comments must start with a capital letter
 314 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 325 | ERROR   | [x] Function comment short description must start with exactly one space
 327 | ERROR   | [x] Expected 1 space after asterisk; 2 found
 327 | ERROR   | [ ] Missing parameter type
 328 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
 330 | ERROR   | [x] Additional blank lines found at end of doc comment
 333 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 340 | ERROR   | [x] Array indentation error, expected 8 spaces but found 24
 345 | ERROR   | [x] Expected newline after closing brace
------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 96 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway/src/StripeServiceApi.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 89 ERRORS AND 29 WARNINGS AFFECTING 85 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
   5 | WARNING | [x] Unused use statement
   6 | WARNING | [x] Unused use statement
   6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactory.
  12 | ERROR   | [x] Doc comment short description must be on the first line
  14 | ERROR   | [x] Additional blank lines found at end of doc comment
  16 | ERROR   | [x] Opening brace should be on the same line as the declaration
  25 | ERROR   | [x] Missing function doc comment
  26 | ERROR   | [x] Opening brace should be on the same line as the declaration
  31 | ERROR   | [x] Function comment short description must start with exactly one space
  33 | ERROR   | [x] Expected "int" but found "integer" for parameter type
  34 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 4 spaces
  34 | ERROR   | [ ] Parameter comment must start with a capital letter
  34 | ERROR   | [x] Parameter comment must end with a full stop
  36 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 4 spaces
  36 | ERROR   | [ ] Parameter comment must start with a capital letter
  36 | ERROR   | [x] Parameter comment must end with a full stop
  39 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4 spaces
  42 | ERROR   | [x] Opening brace should be on the same line as the declaration
  43 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  44 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  50 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
  52 | ERROR   | [x] No space found before comment text; expected "// reason for cancellation" but found "//reason for cancellation"
  52 | ERROR   | [x] Inline comments must start with a capital letter
  52 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  60 | WARNING | [x] A comma should follow the last multiline array item. Found: $reason
  61 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
  64 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  66 | ERROR   | [x] Expected newline after closing brace
  66 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
  69 | ERROR   | [x] Expected newline after closing brace
  70 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  74 | ERROR   | [ ] Parameter $entity_data is not described in comment
  75 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
  75 | ERROR   | [x] Function comment short description must start with exactly one space
  75 | ERROR   | [x] Doc comment short description must end with a full stop
  77 | ERROR   | [x] Expected 1 space after asterisk; 2 found
  77 | ERROR   | [ ] Doc comment for parameter $id does not match actual variable name $entity_data
  78 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 4 spaces
  80 | ERROR   | [x] Additional blank lines found at end of doc comment
  82 | ERROR   | [x] Opening brace should be on the same line as the declaration
  83 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  84 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  87 | ERROR   | [x] Expected 1 space between comma and "'uid'"; 0 found
  87 | ERROR   | [x] Expected one space after the comma, 0 found
  88 | ERROR   | [x] Expected one space after the comma, 0 found
  92 | ERROR   | [x] Comments may not appear after statements
  92 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  93 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
  93 | WARNING | [ ] Line exceeds 80 characters; contains 90 characters
  93 | ERROR   | [x] Comments may not appear after statements
  94 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  97 | ERROR   | [x] Whitespace found at end of line
  98 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 101 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 102 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 104 | ERROR   | [x] There should be no white space before a closing "]"
 104 | ERROR   | [x] Closing parenthesis of array declaration must be on a new line
 105 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 108 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 109 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 110 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
 111 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 112 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 112 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 113 | ERROR   | [x] Short array syntax must be used to define arrays
 113 | ERROR   | [x] The first index in a multi-value array must be on a new line
 114 | ERROR   | [x] Array indentation error, expected 14 spaces but found 12
 114 | ERROR   | [x] Closing parenthesis of array declaration must be on a new line
 115 | ERROR   | [x] Expected newline after closing brace
 116 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 118 | ERROR   | [x] Expected newline after closing brace
 119 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 120 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 121 | ERROR   | [x] Expected one space after the comma, 0 found
 121 | ERROR   | [x] Closing parenthesis of array declaration must be on a new line
 123 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 124 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 126 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 127 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 127 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 128 | ERROR   | [x] Short array syntax must be used to define arrays
 128 | ERROR   | [x] The first index in a multi-value array must be on a new line
 129 | ERROR   | [x] Array indentation error, expected 12 spaces but found 10
 129 | ERROR   | [x] Each index in a multi-line array must be on a new line
 129 | ERROR   | [x] Closing parenthesis of array declaration must be on a new line
 131 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 132 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 133 | ERROR   | [x] Whitespace found at end of line
 138 | ERROR   | [x] Doc comment short description must end with a full stop
 144 | ERROR   | [x] No space found before comment text; expected "// get data subscription" but found "//get data subscription"
 144 | ERROR   | [x] Inline comments must start with a capital letter
 144 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 145 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 147 | ERROR   | [x] Expected 1 space between comma and "'uid'"; 0 found
 147 | ERROR   | [x] Expected one space after the comma, 0 found
 147 | ERROR   | [x] Expected 1 space between comma and "'frequency'"; 0 found
 147 | ERROR   | [x] Expected one space after the comma, 0 found
 150 | ERROR   | [x] Whitespace found at end of line
 152 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 153 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 154 | ERROR   | [x] Object operator not indented correctly; expected 8 spaces but found 18
 158 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 158 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
 159 | ERROR   | [x] Inline comments must start with a capital letter
 160 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 161 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 164 | ERROR   | [x] Expected newline after closing brace
 165 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 166 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 174 | WARNING | [x] A comma should follow the last multiline array item. Found: id
 177 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 177 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 177 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
 177 | ERROR   | [x] Whitespace found at end of line
 180 | ERROR   | [x] Expected newline after closing brace
 181 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 205 | ERROR   | [x] Expected newline after closing brace
 208 | ERROR   | [x] Expected 1 blank line after function; 0 found
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 90 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------
📌 Task
Status

RTBC

Version

1.0

Component

Code

Created by

🇮🇳India realsp

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 @realsp
  • Assigned to realsp
  • 🇮🇳India realsp

    I'll create MR to fix these phpcs issues.

  • Merge request !6Fixed phpcs issues in files → (Merged) created by realsp
  • Issue was unassigned.
  • Status changed to Needs review 5 months ago
  • 🇮🇳India realsp
    FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway-3415165/README.md
    ----------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------
     61 | WARNING | Line exceeds 80 characters; contains 103 characters
    ----------------------------------------------------------------------------------------------
    
    
    FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway-3415165/src/Controller/StripeWebhookController.php
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------
     147 | WARNING | Unused variable $event.
    -------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway-3415165/src/Controller/StripeCheckoutController.php
    --------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    --------------------------------------------------------------------------------------------------------------------------------
     298 | WARNING | Line exceeds 80 characters; contains 86 characters
     426 | ERROR   | Missing parameter type
    --------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/contribution/drupal/web/modules/contrib/stripe_gateway-3415165/src/StripeServiceApi.php
    -------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    -------------------------------------------------------------------------------------------------------------
     152 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     172 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     183 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -------------------------------------------------------------------------------------------------------------
    
    

    I've fixed the remaining phpcs issues, The above mentioned phpcs issues are not updated, because of the following reasons:

    1. Line exceeds warnings are more readable with the existing characters.
    2. Missing Parameter Type (The parameter is of ID, since it's a third-party ID, it can be integer or string)
    3. \Drupal calls services are third-party services as these are not mentioned in the '.services.yml' file (which can be used for Dependency Injection Class)

    Please review the MR, Thank you.

  • Status changed to RTBC 25 days ago
Production build 0.69.0 2024