Fix the issues reported by phpcs

Created on 5 July 2023, 12 months ago
Updated 13 February 2024, 4 months ago

Problem/Motivation

FILE: ...oad/tests/themes/asset_autoload_test_theme/asset_autoload_test_theme.theme
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...w/html/vb/d_cont/asset_autoload/tests/src/Functional/AssetAutoloadTest.php
--------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------
15 | ERROR | Missing short description in doc comment
17 | ERROR | Missing @var tag in member variable comment
20 | ERROR | Missing short description in doc comment
22 | ERROR | Missing @var tag in member variable comment
25 | ERROR | Missing short description in doc comment
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/asset_autoload/src/Scanner.php
--------------------------------------------------------------------------------
FOUND 13 ERRORS AFFECTING 12 LINES
--------------------------------------------------------------------------------
30 | ERROR | [x] Whitespace found at end of line
38 | ERROR | [ ] Missing parameter comment
39 | ERROR | [ ] Missing parameter comment
40 | ERROR | [ ] Missing parameter comment
96 | ERROR | [ ] Description for the @return value is missing
124 | ERROR | [ ] Missing parameter comment
125 | ERROR | [ ] Missing parameter comment
126 | ERROR | [ ] Missing parameter comment
128 | ERROR | [ ] If there is no return value for a function, there must not
| | be a @return tag.
128 | ERROR | [ ] Description for the @return value is missing
140 | ERROR | [x] Use "elseif" in place of "else if"
143 | ERROR | [x] Use "elseif" in place of "else if"
158 | ERROR | [x] Use "elseif" in place of "else if"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/asset_autoload/src/SuggestionHelper.php
-------------------------------------------------------------------------
FOUND 10 ERRORS AFFECTING 9 LINES
-------------------------------------------------------------------------
33 | ERROR | [ ] Missing parameter comment
34 | ERROR | [ ] Missing parameter comment
50 | ERROR | [x] There should be no white space before a closing "]"
59 | ERROR | [ ] Parameter tags must be defined first in a doc comment
59 | ERROR | [ ] Missing parameter comment
60 | ERROR | [ ] Missing parameter comment
61 | ERROR | [ ] Missing parameter comment
63 | ERROR | [ ] Description for the @return value is missing
101 | ERROR | [ ] Missing parameter comment
103 | ERROR | [ ] Description for the @return value is missing
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/asset_autoload/src/FileSystemHelper.php
----------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
17 | ERROR | [x] Data types in @var tags need to be fully namespaced
24 | ERROR | [ ] Missing parameter comment
26 | ERROR | [x] Whitespace found at end of line
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/asset_autoload/src/LibraryInfoHandler.php
-----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------
22 | ERROR | Missing parameter comment
-----------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/asset_autoload/src/ExtensionHelperInterface.php
--------------------------------------------------------------------------------
FOUND 11 ERRORS AFFECTING 10 LINES
--------------------------------------------------------------------------------
15 | ERROR | [ ] Missing parameter comment
15 | ERROR | [ ] Doc comment for parameter $extension does not match actual
| | variable name
17 | ERROR | [ ] Description for the @return value is missing
24 | ERROR | [ ] Missing parameter comment
26 | ERROR | [ ] Description for the @return value is missing
33 | ERROR | [ ] Missing parameter comment
35 | ERROR | [ ] Description for the @return value is missing
41 | ERROR | [x] Whitespace found at end of line
42 | ERROR | [ ] Missing parameter comment
43 | ERROR | [x] Whitespace found at end of line
44 | ERROR | [ ] Description for the @return value is missing
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/asset_autoload/src/PreprocessHandlerInterface.php
-------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------
7 | ERROR | [x] Whitespace found at end of line
-------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/asset_autoload/src/ExtensionHelper.php
--------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
32 | ERROR | Missing parameter comment
33 | ERROR | Missing parameter comment
34 | ERROR | Missing parameter comment
34 | ERROR | Doc comment for parameter $themeManager does not match actual
| | variable name
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/asset_autoload/src/SuggestionHelperInterface.php
--------------------------------------------------------------------------------
FOUND 12 ERRORS AFFECTING 6 LINES
--------------------------------------------------------------------------------
14 | ERROR | [ ] Doc comment short description must be on a single line,
| | further text should be a separate paragraph
15 | ERROR | [x] Whitespace found at end of line
16 | ERROR | [ ] Missing parameter comment
16 | ERROR | [x] Whitespace found at end of line
16 | ERROR | [x] Parameter comment must be on the next line
17 | ERROR | [ ] Missing parameter comment
17 | ERROR | [x] Whitespace found at end of line
17 | ERROR | [x] Parameter comment must be on the next line
18 | ERROR | [ ] Missing parameter comment
18 | ERROR | [x] Whitespace found at end of line
18 | ERROR | [x] Parameter comment must be on the next line
20 | ERROR | [ ] Description for the @return value is missing
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/asset_autoload/src/PreprocessHandler.php
----------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 5 LINES
----------------------------------------------------------------------
30 | ERROR | [x] Whitespace found at end of line
36 | ERROR | [ ] Parameter $scanner is not described in comment
36 | ERROR | [ ] Parameter $themeManager is not described in comment
39 | ERROR | [ ] Missing parameter comment
41 | ERROR | [x] Expected 1 blank line before function; 2 found
76 | ERROR | [ ] Description for the @return value is missing
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/asset_autoload/asset_autoload.module
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 232ms; 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 asset_autoload/

Remaining tasks

Patch review

📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

🇮🇳India urvashi_vora Madhya Pradesh, India

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

  • Issue created by @urvashi_vora
  • Hii @urvashi_vora I have applied your patch.

    These are the steps I followed:

    1. Took clone from git version 1.x in drupal 10.1.x

    2. Ran this command:

    ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig modules/contrib/asset_autoload

    and found errors.

    4.I ran phpcbf and it fixed the issue.

    Attaching screenshots and patch.

    Please Review.

  • Status changed to Needs work 5 months ago
  • 🇮🇳India Ashutosh Ahirwal India

    Hi provided patch in #2 get applied and resolved most of the issue
    Remaining once issue

    Used command with arguments
    ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml web/modules/custom/asset_autoload

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/asset_autoload/src/SuggestionHelper.php
    ----------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------
    51 | ERROR | [x] Use null coalesce operator instead of ternary operator.
    ----------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------

    Time: 309ms; Memory: 12MB

  • Assigned to nitin_lama
  • 🇮🇳India nitin_lama

    Addressing #3. Providing updated patch.

  • 🇮🇳India nitin_lama

    Please review.

  • Issue was unassigned.
  • Status changed to Needs review 5 months ago
  • Hi, reviewed the patch #5 , applies cleanly and fixes all the error/warnings reported.

Production build 0.69.0 2024