Fix the issues reported by phpcs

Created on 10 March 2023, over 1 year ago
Updated 15 March 2023, over 1 year ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/shortcut_menu/shortcut_menu.install
-----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------
24 | ERROR | [x] Each PHP statement must be on a line by itself
-----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/shortcut_menu/src/Form/ShortcutMenuSetCustomize.php
---------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------
12 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
25 | ERROR | [x] Expected 1 space after IF keyword; 0 found
25 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/shortcut_menu/src/ShortcutMenuLazyBuilder.php
-------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
-------------------------------------------------------------------------------------------------------
9 | ERROR | [x] Missing class doc comment
16 | ERROR | [ ] Class property $entity_type_manager should use lowerCamel naming without underscores
18 | ERROR | [ ] Parameter $entity_type_manager is not described in comment
85 | ERROR | [x] Missing function doc comment
-------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------

Time: 4.2 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/shortcut_menu/

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

Needs review

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

Comments & Activities

  • Issue created by @samit.310@gmail.com
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India samit.310@gmail.com

    Above error/warnings has been fixed.

  • Status changed to RTBC over 1 year ago
  • 🇮🇳India hardikpandya

    The patch fixes all phpcs issues. Marking RTBC!

  • @hardikpandya opened merge request.
  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
     /**
    - * Class ShortcutMenuSetCustomize.
    + * The ShortcutMenuSetCustomize Class.

    What does the phpcs report say about that line?

    +/**
    + * The ShortcutMenuLazyBuilder Class.
    + */
    

    What is wrong with those lines?

    -  protected $entity_type_manager;
    +  protected $entityTypeManager;
    

    That is not a necessary change, except in the case the code is already using $entityTypeManager.

  • First commit to issue fork.
  • @kkalashnikov opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India kkalashnikov Ghaziabad, India
  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
     /**
    - * Class ShortcutMenuSetCustomize.
    + * The set customization for shortcut menu.
    

    That does not describe what the class does, nor does it make sense.

    +  /**
    +   * Gets the Parent id from UUID.
    +   */

    Parameters and return value need to be documented.

  • Assigned to elber
  • 🇧🇷Brazil elber Brazil

    I will work on it.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇧🇷Brazil elber Brazil

    Hi I fixed the errors mentioned previously, please revise.

Production build 0.69.0 2024