Problem/Motivation
I have run PHPCS for this module and found the many issues.
vendor/bin/phpcs --standard="Drupal,DrupalPractice" -n --extensions="php,module,inc,install,test,profile,theme,yml" web/modules/contrib/twilio
FILE: /var/www/html/my-drupal10-site/web/modules/contrib/twilio/tests/src/Functional/LoadTest.php
-------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------
FILE: /var/www/html/my-drupal10-site/web/modules/contrib/twilio/twilio.install
------------------------------------------------------------------------------
FOUND 13 ERRORS AFFECTING 12 LINES
------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
11 | ERROR | [x] Short array syntax must be used to define arrays
12 | ERROR | [x] Short array syntax must be used to define arrays
13 | ERROR | [x] Short array syntax must be used to define arrays
14 | ERROR | [x] Short array syntax must be used to define arrays
19 | ERROR | [x] Short array syntax must be used to define arrays
24 | ERROR | [x] Short array syntax must be used to define arrays
30 | ERROR | [x] Short array syntax must be used to define arrays
35 | ERROR | [x] Short array syntax must be used to define arrays
42 | ERROR | [x] Short array syntax must be used to define arrays
43 | ERROR | [x] Short array syntax must be used to define arrays
43 | ERROR | [x] Short array syntax must be used to define arrays
46 | ERROR | [x] Expected 1 newline at end of file; 2 found
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------
FILE: /var/www/html/my-drupal10-site/web/modules/contrib/twilio/src/Controller/TwilioController.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 22 ERRORS AFFECTING 17 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
17 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('CallSid') instead
18 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request instead
32 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('From') instead
32 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('Body') instead
32 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('ToCountry') instead
34 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('ToCountry') instead
38 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('ToCountry') instead
42 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('From') instead
43 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('To') instead
43 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('To') instead
44 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('Body') instead
46 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('MediaUrl0') instead
46 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('MediaUrl0') instead
49 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('To') instead
50 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('To') instead
66 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('From') instead
67 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('From') instead
68 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('To') instead
68 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('To') instead
70 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('To') instead
71 | ERROR | [ ] The $_REQUEST super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->request->get('To') instead
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/my-drupal10-site/web/modules/contrib/twilio/src/Form/NewUserRegisterForm.php
------------------------------------------------------------------------------------------------
FOUND 11 ERRORS AFFECTING 8 LINES
------------------------------------------------------------------------------------------------
3 | ERROR | [x] There must be one blank line after the namespace declaration
14 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
14 | ERROR | [x] Missing function doc comment
15 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
17 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
18 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
20 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
21 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
21 | ERROR | [x] Closing brace indented incorrectly; expected 6 spaces, found 4
22 | ERROR | [x] Expected 1 newline at end of file; 0 found
22 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 11 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------
FILE: /var/www/html/my-drupal10-site/web/modules/contrib/twilio/src/Form/TwilioAdminTestForm.php
------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------
FILE: /var/www/html/my-drupal10-site/web/modules/contrib/twilio/src/Form/UserSettingsForm.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 51 ERRORS AFFECTING 41 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
37 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 3
38 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
39 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
40 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
41 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
55 | ERROR | [x] Expected 1 blank line before function; 2 found
55 | ERROR | [x] Multi-line function declarations must define one parameter per line
55 | ERROR | [x] Expected 1 space between comma and type hint "Connection"; 0 found
55 | ERROR | [x] Expected one space after the comma, 0 found
55 | ERROR | [x] Multi-line function declarations must define one parameter per line
74 | ERROR | [x] Whitespace found at end of line
91 | ERROR | [x] Whitespace found at end of line
91 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
92 | ERROR | [x] Whitespace found at end of line
93 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
95 | ERROR | [x] Short array syntax must be used to define arrays
99 | ERROR | [x] Whitespace found at end of line
101 | ERROR | [x] Short array syntax must be used to define arrays
104 | ERROR | [x] Expected 1 space after "=>"; 2 found
106 | ERROR | [x] Short array syntax must be used to define arrays
120 | ERROR | [x] Short array syntax must be used to define arrays
125 | ERROR | [x] Short array syntax must be used to define arrays
137 | ERROR | [x] Whitespace found at end of line
140 | ERROR | [x] Short array syntax must be used to define arrays
150 | ERROR | [x] Whitespace found at end of line
153 | ERROR | [x] Expected 1 blank line after function; 8 found
156 | ERROR | [ ] More than 2 empty lines are not allowed
157 | ERROR | [ ] More than 2 empty lines are not allowed
158 | ERROR | [ ] More than 2 empty lines are not allowed
159 | ERROR | [ ] More than 2 empty lines are not allowed
160 | ERROR | [x] Whitespace found at end of line
167 | ERROR | [x] Whitespace found at end of line
167 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
168 | ERROR | [x] Whitespace found at end of line
171 | ERROR | [x] Whitespace found at end of line
172 | ERROR | [x] There should be no white space after an opening "("
175 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 6
175 | ERROR | [x] 2 spaces found before inline comment; expected "// $ajax_response->addCommand(new HtmlCommand('#confirm-code', $text));"
| | but found "// $ajax_response->addCommand(new HtmlCommand('#confirm-code', $text));"
176 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 5
176 | ERROR | [x] Closing brace indented incorrectly; expected 6 spaces, found 5
178 | ERROR | [x] Whitespace found at end of line
185 | ERROR | [x] Whitespace found at end of line
192 | ERROR | [x] Expected 1 space after ELSEIF keyword; 0 found
197 | ERROR | [x] Short array syntax must be used to define arrays
201 | ERROR | [x] Space before opening parenthesis of function call prohibited
201 | ERROR | [x] Expected one space after the comma, 0 found
204 | ERROR | [x] Whitespace found at end of line
204 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 3 empty lines
205 | ERROR | [x] Whitespace found at end of line
206 | ERROR | [x] Whitespace found at end of line
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 47 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/my-drupal10-site/web/modules/contrib/twilio/src/Form/TwilioAdminForm.php
--------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
--------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------
FILE: /var/www/html/my-drupal10-site/web/modules/contrib/twilio/src/Routing/RouteSubscriber.php
-----------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
18 | ERROR | [x] Whitespace found at end of line
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------
FILE: /var/www/html/my-drupal10-site/web/modules/contrib/twilio/src/Services/Sms.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 65 ERRORS AFFECTING 50 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
52 | ERROR | [x] Parameter comment must end with a full stop
54 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
55 | ERROR | [x] Parameter comment must end with a full stop
57 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
58 | ERROR | [x] Parameter comment must end with a full stop
63 | ERROR | [ ] Method name "Sms::twilio_user_send_confirmation" is not in lowerCamel format
63 | ERROR | [x] Visibility must be declared on method "twilio_user_send_confirmation"
65 | ERROR | [x] Short array syntax must be used to define arrays
73 | ERROR | [x] No space found before comment text; expected "// $account = user_save($account, array('twilio' => $data), 'twilio');" but
| | found "//$account = user_save($account, array('twilio' => $data), 'twilio');"
85 | ERROR | [x] Parameter comment must end with a full stop
87 | ERROR | [x] Parameter comment must end with a full stop
92 | ERROR | [ ] Method name "Sms::twilio_verify_number" is not in lowerCamel format
92 | ERROR | [x] Visibility must be declared on method "twilio_verify_number"
95 | ERROR | [x] Whitespace found at end of line
105 | ERROR | [x] Whitespace found at end of line
108 | ERROR | [x] Expected 1 blank line after function; 2 found
109 | ERROR | [x] Whitespace found at end of line
110 | ERROR | [x] Whitespace found at end of line
112 | ERROR | [x] Doc comment short description must end with a full stop
114 | ERROR | [ ] Description for the @return value is missing
116 | ERROR | [ ] Method name "Sms::twilio_insert" is not in lowerCamel format
116 | ERROR | [x] Visibility must be declared on method "twilio_insert"
116 | ERROR | [x] Expected 0 spaces before opening parenthesis; 1 found
119 | ERROR | [x] Whitespace found at end of line
123 | ERROR | [x] Whitespace found at end of line
124 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
124 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
128 | ERROR | [x] Doc comment short description must end with a full stop
130 | ERROR | [ ] Description for the @return value is missing
132 | ERROR | [ ] Method name "Sms::twilio_update" is not in lowerCamel format
132 | ERROR | [x] Visibility must be declared on method "twilio_update"
132 | ERROR | [x] Expected 0 spaces before opening parenthesis; 1 found
132 | ERROR | [x] Expected one space after the comma, 0 found
137 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
137 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 4
138 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
139 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
140 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
143 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 3
144 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
144 | ERROR | [x] Doc comment short description must start with a capital letter
144 | ERROR | [x] Doc comment short description must end with a full stop
145 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
146 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
146 | ERROR | [ ] Description for the @return value is missing
147 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
148 | ERROR | [ ] Method name "Sms::twilio_user_delete" is not in lowerCamel format
148 | ERROR | [x] Visibility must be declared on method "twilio_user_delete"
152 | ERROR | [x] Expected one space after the comma, 0 found
154 | ERROR | [x] Expected 1 blank line after function; 0 found
156 | ERROR | [x] Doc comment short description must end with a full stop
158 | ERROR | [ ] Description for the @return value is missing
160 | ERROR | [ ] Method name "Sms::twilio_load" is not in lowerCamel format
160 | ERROR | [x] Visibility must be declared on method "twilio_load"
160 | ERROR | [x] Expected 0 spaces before opening parenthesis; 1 found
163 | ERROR | [x] Whitespace found at end of line
168 | ERROR | [x] Whitespace found at end of line
169 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
170 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
171 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
172 | ERROR | [x] Whitespace found at end of line
173 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
174 | ERROR | [x] Expected 1 blank line after function; 0 found
175 | ERROR | [x] The closing brace for the class must have an empty line before it
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 53 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/my-drupal10-site/web/modules/contrib/twilio/src/Services/Numbers.php
----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------
FILE: /var/www/html/my-drupal10-site/web/modules/contrib/twilio/src/Services/Command.php
----------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
14 | ERROR | [ ] Missing member variable doc comment
15 | ERROR | [ ] Missing member variable doc comment
16 | ERROR | [ ] Missing member variable doc comment
----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------
FILE: /var/www/html/my-drupal10-site/web/modules/contrib/twilio/src/Services/Voice.php
--------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
6 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
68 | ERROR | [ ] Parameter $url is not described in comment
71 | ERROR | [ ] Doc comment for parameter $url|null does not match actual variable name $events
--------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
Steps to reproduce
You can run the following command to reproduce the issue.
vendor/bin/phpcs --standard="Drupal,DrupalPractice" -n --extensions="php,module,inc,install,test,profile,theme,yml" web/modules/contrib/twilio
Proposed resolution
You can run the following command to fix error. after running this PHPCBF command some issue will fix and for the other you need to fix manually.
vendor/bin/phpcbf --standard="Drupal,DrupalPractice" -n --extensions="php,module,inc,install,test,profile,theme,yml" web/modules/contrib/twilio