Fix PHPCS errors and warnings

Created on 6 January 2023, almost 2 years ago
Updated 12 September 2024, 3 months ago

PHPCS reported the followings issues:

FILE: /erg/tests/modules/erg_test/src/Entity/OnPreValidateRefereeReferentAccessCheck.php
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------------
 33 | ERROR | [x] There must not be a newline before the closing parenthesis of a single-line function declaration
--------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------


FILE: /erg/tests/modules/erg_test/src/Entity/OnDeleteReferentDeleteReference.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
 33 | ERROR | [x] There must not be a newline before the closing parenthesis of a single-line function declaration
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------


FILE: erg/tests/modules/erg_test/src/Entity/OnDeleteReferentDeleteReferee.php
----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------
 33 | ERROR | [x] There must not be a newline before the closing parenthesis of a single-line function declaration
----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------


FILE: /erg/tests/modules/erg_test/src/Entity/OnDeleteReferentProtectReferent.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
 33 | ERROR | [x] There must not be a newline before the closing parenthesis of a single-line function declaration
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------


FILE: /erg/src/Field/FieldSettings.php
------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------
 15 | ERROR | Missing member variable doc comment
 16 | ERROR | Missing member variable doc comment
------------------------------------------------------------------------------------------


FILE: /erg/src/EntityReference.php
--------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------------
 19 | ERROR | Missing member variable doc comment
 20 | ERROR | Missing member variable doc comment
 21 | ERROR | Missing member variable doc comment
 22 | ERROR | Missing member variable doc comment
 23 | ERROR | Missing member variable doc comment
--------------------------------------------------------------------------------------


FILE: /erg/src/Guard/EntityAccessCheckGuardBase.php
-------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------
 76 | ERROR | [x] There must not be a newline before the closing parenthesis of a single-line function declaration
-------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------
๐Ÿ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ฉ๐Ÿ‡ชGermany solimanharkas Hamburg

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines cleavinjosh

    Hi @_pratik_,

    I applied MR!4, it was applied smoothly and fixed most of the phpcs issues.

    There are the issues I encountered after I run phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml.

    โžœ  erg git:(8.x-1.x) curl https://git.drupalcode.org/project/erg/-/merge_requests/4.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  7223    0  7223    0     0  17351      0 --:--:-- --:--:-- --:--:-- 17321
    patching file erg.module
    patching file src/EntityReference.php
    patching file src/Field/FieldSettings.php
    patching file src/Guard/EntityAccessCheckGuardBase.php
    patching file tests/modules/erg_test/erg_test.info.yml
    patching file tests/modules/erg_test/src/Entity/OnDeleteReferentDeleteReferee.php
    patching file tests/modules/erg_test/src/Entity/OnDeleteReferentDeleteReference.php
    patching file tests/modules/erg_test/src/Entity/OnDeleteReferentProtectReferent.php
    patching file tests/modules/erg_test/src/Entity/OnPreValidateRefereeReferentAccessCheck.php
    โžœ  erg git:(8.x-1.x) โœ— ..
    โžœ  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml erg
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/tests/modules/erg_test/src/Entity/OnPreValidateRefereeReferentAccessCheck.php
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ------------------------------------------------------------------------------------------------------------------------------------------------------
      3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
     10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\ContentEntityBase.
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/tests/modules/erg_test/src/Entity/OnDeleteReferentDeleteReference.php
    ----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------------
      3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
     10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\ContentEntityBase.
    ----------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/tests/modules/erg_test/src/Entity/OnDeleteReferentDeleteReferee.php
    --------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------------------------------------------------------------------
      3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
     10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\ContentEntityBase.
    --------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/tests/modules/erg_test/src/Entity/OnDeleteReferentProtectReferent.php
    ----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------------
      3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
     10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\ContentEntityBase.
    ----------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/tests/src/Functional/OnPreValidateRefereeReferentAccessCheckTest.php
    ---------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
    ---------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/tests/src/Kernel/OnDeleteReferentDeleteRefereeTest.php
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
    -------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/tests/src/Kernel/OnDeleteReferentProtectReferentTest.php
    -----------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\EntityStorageException.
    -----------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/erg.module
    ------------------------------------------------------------------------------------------------------------------------------------
    FOUND 13 ERRORS AFFECTING 10 LINES
    ------------------------------------------------------------------------------------------------------------------------------------
       8 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
      23 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\erg\Guard\GuardExceptionInterface.
      51 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
      74 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
      98 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
     111 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
     217 | ERROR | [x] The first parameter of a multi-line function declaration must be on the line after the opening bracket
     218 | ERROR | [x] Multi-line function declaration not indented correctly; expected 6 spaces but found 1
     218 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
     218 | ERROR | [x] The closing parenthesis of a multi-line function declaration must be on a new line
     276 | ERROR | [x] The first parameter of a multi-line function declaration must be on the line after the opening bracket
     276 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
     312 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
    ------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/src/Event.php
    --------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
    --------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/src/Plugin/Validation/Constraint/OnValidateRefereeGuardConstraintValidator.php
    -------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
    -------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/src/Plugin/Validation/Constraint/OnValidateRefereeGuardConstraint.php
    ----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
    ----------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/src/Field/FieldSettings.php
    ----------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
    ----------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/src/EntityReference.php
    -----------------------------------------------------------------------------------------------------------------------------
    FOUND 9 ERRORS AFFECTING 8 LINES
    -----------------------------------------------------------------------------------------------------------------------------
      3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
      8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\EntityInterface.
     70 | ERROR | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 8
     71 | ERROR | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 8
     72 | ERROR | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 8
     73 | ERROR | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 8
     74 | ERROR | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 8
     74 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
     75 | ERROR | [x] Multi-line function declaration not indented correctly; expected 2 spaces but found 4
    -----------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/src/Guard/EntityAccessDeniedException.php
    ----------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ----------------------------------------------------------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Access\AccessResultInterface.
    ----------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/src/Guard/ReferentAccessCheckGuard.php
    -----------------------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    -----------------------------------------------------------------------------------------------------------------------------
      3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
      8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\EntityInterface.
     19 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
    -----------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/src/Guard/GuardExceptionInterface.php
    --------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
    --------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/src/Guard/ProtectedReferenceException.php
    ------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
    ------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/src/Guard/DeleteReferenceGuard.php
    -----------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
    -----------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/src/Guard/ProtectReferentGuard.php
    -----------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
    -----------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/src/Guard/GuardInterface.php
    -----------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
    -----------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/src/Guard/DeleteRefereeGuard.php
    ---------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
    ---------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/erg/src/Guard/EntityAccessCheckGuardBase.php
    -----------------------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    -----------------------------------------------------------------------------------------------------------------------------
      3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
      8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\EntityInterface.
     55 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
    -----------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------
    
    Time: 414ms; Memory: 12MB
    
    โžœ  contrib

    Thank you.

  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines cleavinjosh
  • Status changed to Needs review 3 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines cleavinjosh

    Hi,

    Please review MR!4. Thank you.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    avpaderno โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Failed
    3 months ago
    Total: 346s
    #298712
Production build 0.71.5 2024