Problem/Motivation

Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml shows the following errors/warnings which should be fixed.

FILE: web/modules/contrib/braintree_api/modules/braintree_api_test/src/Form/WebhookNotificationTestForm.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------
 10 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
------------------------------------------------------------------------------------------------------------------------------------------


FILE: web/modules/contrib/braintree_api/src/Controller/BraintreeApiWebhook.php
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 1 WARNING AFFECTING 4 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 16 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
 67 | ERROR   | The $_POST super global must not be accessed directly; inject the request.stack service and use $stack->getCurrentRequest()->request->get("bt_signature") instead
 67 | ERROR   | The $_POST super global must not be accessed directly; inject the request.stack service and use $stack->getCurrentRequest()->request->get("bt_payload") instead
 70 | ERROR   | The $_POST super global must not be accessed directly; inject the request.stack service and use $stack->getCurrentRequest()->request->get("bt_signature") instead
 70 | ERROR   | The $_POST super global must not be accessed directly; inject the request.stack service and use $stack->getCurrentRequest()->request->get("bt_payload") instead
 74 | ERROR   | The $_POST super global must not be accessed directly; inject the request.stack service and use $stack->getCurrentRequest()->request->get("bt_signature") instead
 74 | ERROR   | The $_POST super global must not be accessed directly; inject the request.stack service and use $stack->getCurrentRequest()->request->get("bt_payload") instead
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: web/modules/contrib/braintree_api/src/Form/BraintreeApiAdminForm.php
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------
  18 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
 174 | WARNING | Only string literals should be passed to t() where possible
 179 | WARNING | Only string literals should be passed to t() where possible
------------------------------------------------------------------------------------------------------------------


FILE: web/modules/contrib/braintree_api/src/BraintreeApiService.php
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
 11 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
-----------------------------------------------------------------------------------------------------------------

Time: 92ms; Memory: 10MB

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Andrii Momotov created an issue. See original summary.

andrii momotov’s picture

Assigned: Unassigned » andrii momotov

andrii momotov’s picture

Assigned: andrii momotov » Unassigned
Status: Needs work » Needs review

Fixed the errors/warnings reported by PHP_CodeSniffer.
Please review. Thanks!

silvi.addweb’s picture

Status: Needs review » Needs work

Hi, I have tested MR and found below issue

modules/custom/braintree_api/

FILE: /home/addweb/Drupal8-vagrant/web/web/contribution/drupal-10-3/web/modules/custom/braintree_api/src/Controller/BraintreeApiWebhook.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------
 10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\braintree_api\BraintreeApiService.
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/addweb/Drupal8-vagrant/web/web/contribution/drupal-10-3/web/modules/custom/braintree_api/src/Form/BraintreeApiAdminForm.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------------
 10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
---------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------

Time: 144ms; Memory: 10MB
silvi.addweb’s picture

Status: Needs work » Needs review
vinmayiswamy’s picture

Hi @silvi.addweb, thanks for the MR.

I've tested MR !4 on Drupal 10.2.x
The MR is applied Cleanly...

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

RTBC+1

riddhi.addweb’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new101.87 KB
new210.32 KB

The mentioned phpcs issue is resolved, & I have also checked and it is working as expected. I am attaching the Screenshots & doing RTBC for the same.

  • shaundychko committed feb77f5d on 4.0.x
    Issue #3428776 by andrii momotov, silvi.addweb, riddhi.addweb,...

  • andrii momotov committed 1e2336cb on 4.0.x
    Issue #3428776: Fix the errors/warnings reported by PHP_CodeSniffer
    
shaundychko’s picture

Status: Reviewed & tested by the community » Fixed

Thank you all for your help.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.