Fix the issues reported by phpcs

Created on 21 February 2023, almost 2 years ago
Updated 31 July 2024, 6 months ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/hierarchy_manager/css/Plugin/jstree/hm.jstree.css
-------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------
1 | ERROR | [x] Additional whitespace found at start of file
-------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/hierarchy_manager/hierarchy_manager.install
-------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------
19 | ERROR | [x] Data types in @var tags need to be fully namespaced
-------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/hierarchy_manager/README.md
------------------------------------------------------------------------
FOUND 1 ERROR AND 7 WARNINGS AFFECTING 8 LINES
------------------------------------------------------------------------
13 | WARNING | [ ] Line exceeds 80 characters; contains 174 characters
15 | WARNING | [ ] Line exceeds 80 characters; contains 476 characters
17 | WARNING | [ ] Line exceeds 80 characters; contains 185 characters
24 | WARNING | [ ] Line exceeds 80 characters; contains 150 characters
34 | WARNING | [ ] Line exceeds 80 characters; contains 140 characters
36 | WARNING | [ ] Line exceeds 80 characters; contains 225 characters
38 | WARNING | [ ] Line exceeds 80 characters; contains 296 characters
43 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/hierarchy_manager/hierarchy_manager.module
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 1 WARNING AFFECTING 5 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
29 | ERROR | [x] Inline comments must start with a capital letter
34 | ERROR | [x] Inline comments must start with a capital letter
43 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for
| | xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
44 | ERROR | [x] Whitespace found at end of line
51 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
51 | ERROR | [x] Object operator not indented correctly; expected 4 spaces but found 2
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/hierarchy_manager/src/Form/HmDisplayProfileForm.php
----------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 3 WARNINGS AFFECTING 7 LINES
----------------------------------------------------------------------------------------------------------------------
13 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
52 | WARNING | [ ] Unused variable $key.
86 | ERROR | [x] Whitespace found at end of line
87 | ERROR | [x] Short array syntax must be used to define arrays
106 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
134 | ERROR | [x] Whitespace found at end of line
145 | ERROR | [x] Whitespace found at end of line
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/hierarchy_manager/src/Form/HMConfigForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
13 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
119 | ERROR | The array declaration extends to column 109 (the limit is 80). The array content should be split up over multiple lines
-----------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/hierarchy_manager/src/Form/HmMenuForm.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 14 ERRORS AFFECTING 11 LINES
-------------------------------------------------------------------------------------------------------------------------------------------
10 | ERROR | [x] Missing class doc comment
15 | ERROR | [x] Expected "bool|null" but found "bool|NULL" for @var tag in member variable comment
40 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
69 | ERROR | [x] Data types in @param tags need to be fully namespaced
71 | ERROR | [x] Separate the @param and @return sections by a blank line.
71 | ERROR | [x] Expected "null|array" but found "NULL|array" for function return type
71 | ERROR | [ ] Description for the @return value is missing
97 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
98 | ERROR | [ ] The array declaration extends to column 153 (the limit is 80). The array content should be split up over multiple lines
98 | ERROR | [ ] The array declaration extends to column 152 (the limit is 80). The array content should be split up over multiple lines
112 | ERROR | [ ] Description for the @return value is missing
128 | ERROR | [x] Expected "bool|null" but found "boolean|NULL" for function return type
153 | ERROR | [x] Expected 1 blank line after function; 0 found
154 | ERROR | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/hierarchy_manager/src/Form/HmOverviewTerms.php
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------
64 | ERROR | The array declaration extends to column 165 (the limit is 80). The array content should be split up over multiple lines
64 | ERROR | The array declaration extends to column 164 (the limit is 80). The array content should be split up over multiple lines
--------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/hierarchy_manager/src/Entity/HmDisplayProfile.php
-------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
-------------------------------------------------------------------------------------
70 | ERROR | [x] Whitespace found at end of line
72 | ERROR | [x] Doc comment short description must end with a full stop
73 | ERROR | [x] Whitespace found at end of line
84 | ERROR | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/hierarchy_manager/src/Plugin/HmDisplayPlugin/HmDisplayJstree.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 1 WARNING AFFECTING 8 LINES
-------------------------------------------------------------------------------------------------------------------------------
26 | ERROR | [x] You must use "/**" style comments for a function comment
47 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
47 | ERROR | [x] Object operator not indented correctly; expected 10 spaces but found 8
52 | ERROR | [x] Use null coalesce operator instead of ternary operator.
71 | ERROR | [x] Use null coalesce operator instead of ternary operator.
116 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
125 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
133 | ERROR | [x] Expected 1 blank line after function; 0 found
134 | ERROR | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/hierarchy_manager/src/Plugin/HmSetupPlugin/HmMenu.php
-----------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------
25 | ERROR | [x] Data types in @var tags need to be fully namespaced
32 | ERROR | [x] Expected 1 newline at end of file; 2 found
-----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/hierarchy_manager/src/Plugin/HmDisplayPluginInterface.php
---------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
---------------------------------------------------------------------------------------------
16 | ERROR | [x] You must use "/**" style comments for a function comment
17 | ERROR | [x] Whitespace found at end of line
21 | ERROR | [x] Expected 1 blank line after function; 0 found
22 | ERROR | [x] The closing brace for the interface must have an empty line before it
---------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/hierarchy_manager/src/Plugin/HmSetupPluginBase.php
------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
------------------------------------------------------------------------------------------
19 | ERROR | [x] Scope keyword "protected" must be followed by a single space; found 2
26 | ERROR | [x] Scope keyword "protected" must be followed by a single space; found 2
66 | WARNING | [ ] #description values usually have to run through t() for translation
75 | WARNING | [x] A comma should follow the last multiline array item. Found: )
------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/hierarchy_manager/src/Controller/HmTaxonomyController.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 20 ERRORS AND 1 WARNING AFFECTING 21 LINES
-------------------------------------------------------------------------------------------------------------------------------
35 | ERROR | [x] Whitespace found at end of line
72 | ERROR | [x] Expected 1 blank line after function; 2 found
79 | ERROR | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
81 | ERROR | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
116 | ERROR | [x] Whitespace found at end of line
117 | ERROR | [x] Expected 1 space after IF keyword; 0 found
142 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
145 | ERROR | [x] Expected 1 space after "="; 2 found
155 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
156 | ERROR | [x] There should be no white space after an opening "("
157 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
163 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
170 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
180 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
185 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
208 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
226 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
229 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
234 | ERROR | [x] Expected 1 space after closing brace; 0 found
297 | ERROR | [x] Whitespace found at end of line
307 | WARNING | [ ] Term::loadMultiple calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 20 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/hierarchy_manager/src/Controller/HmMenuController.php
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 25 ERRORS AND 2 WARNINGS AFFECTING 19 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
18 | ERROR | [x] Missing class doc comment
63 | ERROR | [x] Doc comment short description must end with a full stop
132 | ERROR | [x] Inline comments must start with a capital letter
158 | ERROR | [ ] Parameter $mid is not described in comment
163 | ERROR | [ ] Doc comment for parameter $vid does not match actual variable name $mid
191 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 10
192 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 10
217 | ERROR | [ ] The array declaration extends to column 106 (the limit is 80). The array content should be split up over multiple lines
234 | ERROR | [x] Expected "null|object" but found "NULL|object" for function return type
234 | ERROR | [ ] Description for the @return value is missing
247 | ERROR | [ ] Parameter comment must start with a capital letter
247 | ERROR | [x] Parameter comment must end with a full stop
253 | ERROR | [x] Scope keyword "protected" must be followed by a single space; found 2
281 | ERROR | [ ] Parameter comment must start with a capital letter
281 | ERROR | [x] Parameter comment must end with a full stop
284 | ERROR | [ ] Doc comment for parameter $destination does not match actual variable name
287 | ERROR | [x] Scope keyword "protected" must be followed by a single space; found 2
313 | ERROR | [ ] Type hint "array" missing for $tree
314 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
314 | ERROR | [x] 4 spaces found before inline comment; expected "// $tree_access_cacheability = new CacheableMetadata();" but found "// $tree_access_cacheability =
| | new CacheableMetadata();"
316 | WARNING | [x] There must be no blank line following an inline comment
316 | WARNING | [ ] There must be no blank line following an inline comment
316 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 0
316 | ERROR | [x] 6 spaces found before inline comment; expected "// $tree_access_cacheability =
| | $tree_access_cacheability->merge(CacheableMetadata::createFromObject($element->access));" but found "// $tree_access_cacheability =
| | $tree_access_cacheability->merge(CacheableMetadata::createFromObject($element->access));"
365 | ERROR | [x] Expected 1 blank line after function; 0 found
366 | ERROR | [x] Expected 1 newline at end of file; 2 found
366 | ERROR | [x] The closing brace for the class must have an empty line before it
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 18 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/hierarchy_manager/src/PluginTypeManager.php
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 37 ERRORS AND 1 WARNING AFFECTING 34 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
10 | ERROR | [x] Missing class doc comment
11 | ERROR | [x] Whitespace found at end of line
18 | ERROR | [x] Whitespace found at end of line
25 | ERROR | [x] Whitespace found at end of line
32 | ERROR | [x] Whitespace found at end of line
41 | ERROR | [x] Whitespace found at end of line
42 | ERROR | [ ] Parameter $draggable is not described in comment
44 | ERROR | [x] Whitespace found at end of line
53 | ERROR | [x] Expected "bool" but found "boolean" for parameter type
56 | ERROR | [x] Parameter comment must end with a full stop
57 | ERROR | [x] Separate the @param and @return sections by a blank line.
61 | ERROR | [x] Language constructs must be followed by a single space; expected 1 space but found "ยท\n"
61 | ERROR | [x] Whitespace found at end of line
69 | WARNING | [x] A comma should follow the last multiline array item. Found: $draggable
72 | ERROR | [x] Whitespace found at end of line
75 | ERROR | [x] Whitespace found at end of line
78 | ERROR | [x] Separate the @param and @return sections by a blank line.
78 | ERROR | [x] Expected "null|object" but found "NULL|object" for function return type
87 | ERROR | [x] Whitespace found at end of line
90 | ERROR | [x] Whitespace found at end of line
96 | ERROR | [x] Separate the @param and @return sections by a blank line.
96 | ERROR | [x] Expected "null|\Drupal\Core\Config\Entity\ConfigEntityBase" but found "NULL|\Drupal\Core\Config\Entity\ConfigEntityBase" for function return type
103 | ERROR | [x] Language constructs must be followed by a single space; expected 1 space but found "ยทยท"
105 | ERROR | [x] Whitespace found at end of line
107 | ERROR | [x] Doc comment short description must end with a full stop
108 | ERROR | [x] Whitespace found at end of line
112 | ERROR | [x] Parameter comment must end with a full stop
117 | ERROR | [x] Whitespace found at end of line
135 | ERROR | [x] Expected 1 space before "="; 0 found
145 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
148 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
165 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
178 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
183 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
213 | ERROR | [x] Whitespace found at end of line
215 | ERROR | [x] Expected 1 blank line after function; 0 found
216 | ERROR | [x] Expected 1 newline at end of file; 2 found
216 | ERROR | [x] The closing brace for the class must have an empty line before it
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 37 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

Time: 2.03 secs; Memory: 6MB

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/hierarchy_manager/

Proposed resolution

Above error/warnings need to be fixed.

๐Ÿ“Œ Task
Status

Closed: outdated

Version

3.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

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 @samit.310@gmail.com
  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

    Above error/warnings are fixed.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Status changed to RTBC almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia TanujJain-TJ

    Verified patch #2, tested it on Drupal 10.1x and hierarchy manager 3.3.1, the patch applied successfully and fixed all above mentioned phpcs errors and warnings. RTBC +1

  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    -    // jsoneditor min js.
    +    // Jsoneditor min js.
         $cdn_library = _hierarchy_manager_use_cdn($libraries, 'libraries.jsoneditor', 'js');
         if ($cdn_library) {
           $libraries['libraries.jsoneditor']['js'] = $cdn_library;
         }
    -    // jsoneditor default theme.
    +    // Jsoneditor default theme.
    

    Those comments can be removed, since they just say what is already obvious from the code.

    +/**
    + * The HmMenuController Controller Class.
    + */
    

    A documentation comment for a class should not repeat the class name, which is already given from the code, and which type of class it is. It should describe the class purpose.

    +   * @return null|object
    +   *   The hierarchy_manager object.
    

    The description should use something different from hierarchy_manager and say when NULL is returned.

    -   *   parent id
    +   *   Parent id.
    

    The article is missing.

    -   * The configurations
    -   * 
    +   * The configurations.
    +   *
    

    It is configuration.

    -        // The overview form implemented by Drupal Menu UI module
    +        // The overview form implemented by Drupal Menu UI module.
    

    That sentence can be removed.

    +   * @return null|array
    +   *   Form array of display plugin instance OR null.
    

    The articles are missing and OR is misspelled.

    -        // Urls
    -        $source_url = Url::fromRoute('hierarchy_manager.menu.tree.json', ['mid' => $mid], ['query' => ['token' => $token, 'destination' => $destination]])->toString();
    -        $update_url = Url::fromRoute('hierarchy_manager.menu.tree.update', ['mid' => $mid], ['query' => ['token' => $token]])->toString();
    +        // Urls.
    

    It should be URLs, but that comment is useless and can be removed.

    +   * @return bool|null
        *   Return TRUE if the menu plugin is enabled,
        *   otherwise return FALSE.
    

    The type hinting does not match with the description.

             '#title' => $this
    -        ->t('Search'),
    +          ->t('Search'),
    

    The method should be on the same line containing the variable.

    +  /**
        * Build the tree form.
        */
       public function getForm(string $url_source, string $url_update, array &$form = [], FormStateInterface &$form_state = NULL, $options = NULL);
    -  
    +
       /**
        * Build the data array that JS library accepts.
        */
    

    The parameters are not described.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kkalashnikov Ghaziabad, India
  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kkalashnikov Ghaziabad, India
  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    +   * @return null|object
    +   *   The hierarchy manager object.
    

    It still does not explain when NULL is returned.

    -   *   parent id
    +   *   The Parent id.
    

    parent was already written correctly; it is id that needs to be fixed.

    -   *  User account.
    +   *   User account.
        * @param string $vid
    -   *  Vocabulary ID.
    +   *   Vocabulary ID.
    

    The article is missing.

    - * Class HMConfigForm.
    + * The HMConfigForm Class.
    

    Adding the article is not sufficient. The documentation comment for a class should describe the class purpose.

    +   *   The Parent form array.
    +   * @param \Drupal\Core\Form\FormStateInterface $form_state
    +   *   The Form state object.
    +   *
    +   * @return null|array
    +   *   The Form array of display plugin instance or null.
    

    Parent should be written in lower-case characters, since it is not at the beginning of a sentence; the same is true for Form.
    The last comment does not make much sense.

    -   * @return boolean|NULL
    -   *   Return TRUE if the menu plugin is enabled,
    -   *   otherwise return FALSE.
    +   * @return bool|null
    +   *   Return menu plugin is enabled
        */
    

    The existing description is already correct, except it does not explain when NULL is returned (assuming it is really returned). The new description is not grammatically correct.

    +   * @param string $url_update
    +   *   The URL update.
    

    Probably it is The update URL.

    +   * @param string $confirm
    +   *   The confirm true/false.
    

    Since it is a string, and probably not limited to true and false as its values, that description needs to be changed.

    -      // Custom data
    +      // Custom data.
    

    That comment can be removed, since it does not explain much.

    +   * @param bool $draggable
    +   *   The draggable status.
    

    Whether the item is draggable. is probably better.

    +   * @return null|object
        *   The display plugin instance.
    

    It does not explain when NULL is returned.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kkalashnikov Ghaziabad, India

    thanks @apaderno for reviewing. I have taken care all those points in this patch.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
      * @param bool $replace_local
    - *   Force to replace local libraries with CDN.
    + *   The Force to replace local libraries with CDN.
    

    Force to replace local libraries with CDN. is wrong to describe a Boolean parameter, but adding an article does not fix the sentence. Furthermore, adding the article changes the verb to a noun.

    -   * @return NULL|object
    +   * @return null|object
    +   *   The hierarchy manager object or null.

    At least it says it can return NULL.

     /**
    - * Class HmDisplayProfileForm.
    + * The HmDisplayProfileForm Class.

    With or without Class, before or after the class name, still the documentation comment just repeats the class name.

    +   * @return null|array
    +   *   The form array of display plugin instance or null.

    The article is missing.

    -   * @return boolean|NULL
    -   *   Return TRUE if the menu plugin is enabled,
    -   *   otherwise return FALSE.
    +   * @return bool|null
    +   *   Return menu plugin is enabled

    The original comment was almost correct, except it did not need to say Return/return.

    +   * @param array $form
    +   *   The form array.

    The form is sufficient.

    +   * @param string $confirm
    +   *   The confirm.

    That needs to be expanded.

  • Merge request !183343297: Phpcs issues โ†’ (Open) created by kkalashnikov
  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kkalashnikov Ghaziabad, India

    @apaderno Included comments #10 in this MR.

  • Status changed to Needs work 6 months ago
  • Hi @kkalashnikov,

    Applied the patch you provided, it was applied successfully but errors were still reported. Please see below:

    hierarchy_manager git:(3.x) curl https://git.drupalcode.org/project/hierarchy_manager/-/merge_requests/18.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 42625    0 42625    0     0  99532      0 --:--:-- --:--:-- --:--:--   99k
    patching file README.md
    patching file css/Plugin/jstree/hm.jstree.css
    patching file hierarchy_manager.install
    patching file hierarchy_manager.module
    patching file src/Controller/HmMenuController.php
    patching file src/Controller/HmTaxonomyController.php
    patching file src/Entity/HmDisplayProfile.php
    patching file src/Form/HMConfigForm.php
    patching file src/Form/HmDisplayProfileForm.php
    patching file src/Form/HmMenuForm.php
    patching file src/Form/HmOverviewTerms.php
    patching file src/Plugin/HmDisplayPlugin/HmDisplayJstree.php
    patching file src/Plugin/HmDisplayPluginInterface.php
    patching file src/Plugin/HmSetupPlugin/HmMenu.php
    patching file src/Plugin/HmSetupPluginBase.php
    patching file src/PluginTypeManager.php
    โžœ  hierarchy_manager git:(3.x) โœ— cd ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig hierarchy_manager
    
    FILE: ...v9/web/modules/contrib/hierarchy_manager/src/Form/HmDisplayProfileForm.php
    --------------------------------------------------------------------------------
    FOUND 4 ERRORS AFFECTING 3 LINES
    --------------------------------------------------------------------------------
      9 | ERROR | [x] Use statements should be sorted alphabetically. The first
        |       |     wrong one is
        |       |     Drupal\hierarchy_manager\Plugin\HmDisplayPluginManager.
     27 | ERROR | [x] Multi-line function declaration not indented correctly;
        |       |     expected 4 spaces but found 6
     27 | ERROR | [x] Multi-line function declarations must have a trailing comma
        |       |     after the last parameter
     28 | ERROR | [x] Multi-line function declaration not indented correctly;
        |       |     expected 2 spaces but found 6
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...rgissue-v9/web/modules/contrib/hierarchy_manager/src/Form/HMConfigForm.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     28 | ERROR | [x] Multi-line function declarations must have a trailing comma
        |       |     after the last parameter
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...-orgissue-v9/web/modules/contrib/hierarchy_manager/src/Form/HmMenuForm.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Core\Form\FormStateInterface.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...ssue-v9/web/modules/contrib/hierarchy_manager/src/Form/HmOverviewTerms.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Core\Form\FormStateInterface.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...s/contrib/hierarchy_manager/src/Plugin/HmDisplayPlugin/HmDisplayJstree.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     10 | ERROR | [x] Use statements should be sorted alphabetically. The first
        |       |     wrong one is
        |       |     Drupal\hierarchy_manager\Plugin\HmDisplayPluginBase.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: .../modules/contrib/hierarchy_manager/src/Plugin/HmSetupPlugin/HmTaxonomy.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is
       |       |     Drupal\hierarchy_manager\Plugin\HmSetupPluginBase.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: .../web/modules/contrib/hierarchy_manager/src/Plugin/HmSetupPlugin/HmMenu.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is
       |       |     Drupal\hierarchy_manager\Plugin\HmSetupPluginBase.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: .../web/modules/contrib/hierarchy_manager/src/Plugin/HmSetupPluginManager.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Core\Cache\CacheBackendInterface.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...eb/modules/contrib/hierarchy_manager/src/Plugin/HmDisplayPluginManager.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Core\Cache\CacheBackendInterface.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: .../modules/contrib/hierarchy_manager/src/Controller/HmTaxonomyController.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     14 | ERROR | [x] Use statements should be sorted alphabetically. The first
        |       |     wrong one is Symfony\Component\HttpFoundation\JsonResponse.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: .../web/modules/contrib/hierarchy_manager/src/Controller/HmMenuController.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Core\Access\CsrfTokenGenerator.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 713ms; Memory: 12MB

    Kindly check

    Thanks,
    Jake

  • Status changed to Closed: outdated 6 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia mingsong ๐Ÿ‡ฆ๐Ÿ‡บ

    Thanks everyone.

    I close this issue as it has been fixed with 3.4.0

  • Pipeline finished with Failed
    6 months ago
    Total: 165s
    #239125
Production build 0.71.5 2024