Fix the warnings/errors reported by PHP_CodeSniffer

Created on 7 July 2023, over 1 year ago

Problem/Motivation

FILE: /home/lenovo/d7to9/web/modules/contrib/amazon_sns/src/Event/MessageEventDispatcher.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
   |       |     Drupal\Core\DependencyInjection\ContainerInjectionInterface.
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/amazon_sns/src/Event/SnsMessageEvent.php
---------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Aws\Sns\Message.
---------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/amazon_sns/src/Form/SnsSettingsForm.php
------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------
 54 | ERROR | [x] Short array syntax must be used to define arrays
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/amazon_sns/tests/fixtures/plain-text-message-server.php
----------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------
 1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------

Time: 219ms; Memory: 10MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig amazon_sns/

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India roshni27

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 @roshni27
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 8
    last update over 1 year ago
    11 pass
  • šŸ‡®šŸ‡³India roshni27

    Please review patch.

  • Status changed to RTBC over 1 year ago
  • šŸ‡§šŸ‡ŖBelgium Frederikvho Belgium

    Hi,

    I applied the patch from comment #2 and ran PHPCS again.
    I did not receive any warnings/errors.

    (base) āžœ  amazon_sns git:(8.x-1.x) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig .
    (base) āžœ  amazon_sns git:(8.x-1.x) āœ—
    
  • Status changed to Needs work 3 months ago
  • šŸ‡ØšŸ‡­Switzerland berdir Switzerland

    Needs to be a merge request now.

  • šŸ‡§šŸ‡ŖBelgium Frederikvho Belgium

    Converted previous patch to MR and sorted the imports.

  • Pipeline finished with Success
    3 months ago
    Total: 205s
    #320022
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi frederikvho,

    I applied MR !6 but I can still see some PHPCS issues

    āžœ  amazon_sns git:(65644ed) curl https://git.drupalcode.org/project/amazon_sns/-/merge_requests/6.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  6301    0  6301    0     0  12655      0 --:--:-- --:--:-- --:--:-- 12806
    patching file 'src/Controller/NotificationController.php'
    patching file 'src/Event/MessageEventDispatcher.php'
    patching file 'src/Event/SnsMessageEvent.php'
    patching file 'src/Form/SnsSettingsForm.php'
    patching file 'tests/fixtures/plain-text-message-server.php'
    patching file 'tests/src/Kernel/SnsNotificationSubscriberTest.php'
    patching file 'tests/src/Unit/NotificationControllerTest.php'
    patching file 'tests/src/Unit/RequestMessageValidatorTest.php'
    patching file 'tests/src/Unit/SnsMessageEventTest.php'
    patching file 'tests/src/Unit/SnsSubscriptionConfirmationSubscriberTest.php'
    āžœ  amazon_sns git:(65644ed) āœ— ..
    āžœ  contrib git:(2.1.x) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml amazon_sns 
    
    FILE: ...ib/amazon_sns/tests/src/Unit/SnsSubscriptionConfirmationSubscriberTest.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\amazon_sns\Event\SnsMessageEvent.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...trib/web/modules/contrib/amazon_sns/tests/src/Unit/SnsMessageEventTest.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\amazon_sns\Event\SnsMessageEvent.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: .../modules/contrib/amazon_sns/tests/src/Unit/RequestMessageValidatorTest.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\amazon_sns\RequestMessageValidator.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...b/modules/contrib/amazon_sns/tests/src/Unit/NotificationControllerTest.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is
       |       |     Drupal\amazon_sns\Controller\NotificationController.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...ules/contrib/amazon_sns/tests/src/Kernel/SnsNotificationSubscriberTest.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is
       |       |     Drupal\amazon_sns\Controller\NotificationController.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...b/web/modules/contrib/amazon_sns/src/Controller/NotificationController.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     10 | ERROR | [x] Use statements should be sorted alphabetically. The first
        |       |     wrong one is Drupal\amazon_sns\Event\MessageEventDispatcher.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 345ms; Memory: 10MB
    
    āžœ  contrib git:(2.1.x) āœ— 
    
  • First commit to issue fork.
  • Pipeline finished with Success
    3 months ago
    Total: 307s
    #320178
  • šŸ‡§šŸ‡ŖBelgium Frederikvho Belgium

    Interesting, I didn't get any other phpcs errors with my last commit. And sorting use statements was what I had fixed on top of applying patch from #3.
    Now with the latest addition in #8 I do get phpcs errors, about sorting use statements, again.

    What version of phpcs and drupal/coder are you running? I just verified, and I am running the latest version.
    phpcs: PHP_CodeSniffer version 3.10.3 (stable) by Squiz and PHPCSStandards
    drupal/coder: 8.3.25

  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi frederikvho,

    I have the same version of PHPCS with you and I checked the updated MR !6 and I can confirmed that there's no PHPCS issues in the module

    āžœ  amazon_sns git:(65644ed) curl https://git.drupalcode.org/project/amazon_sns/-/merge_requests/6.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2048    0  2048    0     0   4317      0 --:--:-- --:--:-- --:--:--  4394
    patching file 'src/Event/MessageEventDispatcher.php'
    patching file 'src/Event/SnsMessageEvent.php'
    patching file 'src/Form/SnsSettingsForm.php'
    patching file 'tests/fixtures/plain-text-message-server.php'
    āžœ  amazon_sns git:(65644ed) āœ— ..
    āžœ  contrib git:(2.1.x) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml amazon_sns 
    āžœ  contrib git:(2.1.x) āœ— 

    RTBC +1 from me, will retain the status to needs review for others.

  • šŸ‡ØšŸ‡­Switzerland berdir Switzerland

    Gitlab CI reports issues too.

Production build 0.71.5 2024