Fix the issues reported by phpcs

Created on 25 May 2023, over 1 year ago
Updated 26 May 2023, over 1 year ago

Problem/Motivation

/Desktop/Projects/drupal10-test/web/modules/contrib/twilio (8.x-3.x) $ ddev ssh
/var/www/html$ vendor/bin/phpcs --standard=DrupalPractice,Drupal --extensions=php,module,info,txt,yml web/modules/contrib/twilio/

FILE: /var/www/html/web/modules/contrib/twilio/twilio.module
---------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 3 LINES
---------------------------------------------------------------------------------------------------
12 | WARNING | [x] Unused use statement
106 | ERROR | [x] Space after closing parenthesis of function call prohibited
106 | ERROR | [x] Space found before semicolon; expected ");" but found ") ;"
108 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
---------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/twilio/twilio.routing.yml
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------
28 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
34 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
40 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/twilio/src/Plugin/views/field/TwilioUserCountry.php
-------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
-------------------------------------------------------------------------------------------
54 | WARNING | [ ] Line exceeds 80 characters; contains 141 characters
86 | ERROR | [x] Expected 1 blank line after function; 0 found
87 | ERROR | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/twilio/src/Plugin/views/field/TwilioUserPhone.php
-----------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
-----------------------------------------------------------------------------------------
54 | WARNING | [ ] Line exceeds 80 characters; contains 141 characters
86 | ERROR | [x] Expected 1 blank line after function; 0 found
87 | ERROR | [x] The closing brace for the class must have an empty line before it
-----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/twilio/src/Form/UserSettingsForm.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 11 WARNINGS AFFECTING 11 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
10 | WARNING | [x] Unused use statement
82 | ERROR | [x] Expected one space after the comma, 0 found
82 | ERROR | [x] Incorrect spacing between argument "$user" and equals sign; expected 1 but found 0
98 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
99 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
112 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
117 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
118 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
132 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
134 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
156 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
156 | WARNING | [ ] Only string literals should be passed to t() where possible
165 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/twilio/src/Form/TwilioAdminTestForm.php
-------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------
106 | ERROR | [x] Whitespace found at end of line
-------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/twilio/src/Services/Voice.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
6 | WARNING | [x] Unused use statement
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/twilio/src/Services/Sms.php
--------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 2 WARNINGS AFFECTING 8 LINES
--------------------------------------------------------------------------------------------------
11 | WARNING | [x] Unused use statement
18 | ERROR | [ ] Missing short description in doc comment
40 | ERROR | [x] Expected 1 space before opening brace; found 2
44 | ERROR | [x] Expected 1 blank line after function; 2 found
75 | ERROR | [x] Expected one space after the comma, 0 found
78 | ERROR | [x] Expected 1 space after CATCH keyword; 0 found
79 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
110 | ERROR | [x] Concat operator must be surrounded by a single space
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/twilio/src/Services/Command.php
------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------
124 | WARNING | [x] A comma should follow the last multiline array item. Found: $message
------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/twilio/src/Routing/RouteSubscriber.php
------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
------------------------------------------------------------------------------
17 | WARNING | [ ] There must be no blank line following an inline comment
17 | WARNING | [x] There must be no blank line following an inline comment
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------

Steps to reproduce

vendor/bin/phpcs --standard=DrupalPractice,Drupal --extensions=php,module,info,txt,yml web/modules/contrib/twilio/

Proposed resolution

vendor/bin/phpcbf --standard=DrupalPractice,Drupal --extensions=php,module,info,txt,yml web/modules/contrib/twilio/
It will fix some automatic issue after that need to fix manually.

📌 Task
Status

Fixed

Component

Code

Created by

🇮🇳India Nishant

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

Comments & Activities

Production build 0.71.5 2024