Fix the issues reported by phpcs

Created on 19 May 2023, over 1 year ago
Updated 17 February 2024, 9 months ago

Problem/Motivation

FILE: ...dules/contrib/user_agent_class/src/EventSubscriber/UserAgentSubscriber.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
14 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
--------------------------------------------------------------------------------

FILE: ...n/drupal10/web/modules/contrib/user_agent_class/src/CheckAgentServices.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
9 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
--------------------------------------------------------------------------------

FILE: ...dules/contrib/user_agent_class/src/Controller/CheckUserAgentController.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
11 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
--------------------------------------------------------------------------------

FILE: ...0/web/modules/contrib/user_agent_class/src/CheckAgentServicesInterface.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
7 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
--------------------------------------------------------------------------------

FILE: ...al10/web/modules/contrib/user_agent_class/src/Form/UserAgentEntityForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
10 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
--------------------------------------------------------------------------------

FILE: ...rupal10/web/modules/contrib/user_agent_class/src/Form/DeviceEntityForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
10 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
--------------------------------------------------------------------------------

FILE: ...ion/drupal10/web/modules/contrib/user_agent_class/src/Form/ProvideForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
10 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
--------------------------------------------------------------------------------

Time: 731ms; Memory: 10MB

Steps to reproduce

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

Proposed resolution

Fix the issues for Drupal and DrupalPractice coding standards

Remaining tasks

Patch review.

📌 Task
Status

Fixed

Version

6.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
  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    - * Class CheckAgentServices.
    + * Implements CheckAgentServicesInterface for CheckAgentServices.

    Class descriptions must not start with Implements and then repeat the class name and the interface name. That information is already given from the code. What descriptions should do is describing the class purpose or what the class does.

     /**
    - * Interface CheckAgentServicesInterface.
    + * Check Agent Services Interface.

    That is still repeating the interface name, even if spaces have been added.

     /**
    - * Class CheckUserAgentController.
    + * Controller for CheckUserAgentController.
      */

    That description is still repeating the class name.

  • 🇮🇳India urvashi_vora Madhya Pradesh, India

    Thanks for the feedback will provide a patch asap.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India urvashi_vora Madhya Pradesh, India

    Providing the updated patch with suggestions of #2. Please review.
    Thanks

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
     /**
    - * Class CheckAgentServices.
    + * Service for Checking user agents.
      */

    Only the first word in the description must be capitalized.

    - * Class UserAgentSubscriber.
    + * Implements EventSubscriberInterface for UserAgentSubscriber.

    The description must say what the class purpose is, not which interfaces are implemented by the class or the class name.

     /**
    - * Class DeviceEntityForm.
    + * Entity Form for DeviceEntityForm.
      */
     /**
    - * Class UserAgentEntityForm.
    + * Entity Form for UserAgentEntityForm.
      */

    If those are entity form classes, for should be followed by the entity for which those forms are built.

     /**
    - * Class ProvideForm.
    + * Provide Form.
      */
     class ProvideForm extends ConfigFormBase {

    That is still repeating the class name, except a space has been put in the middle of the class name. That description does not say what the class does. (Hint: It extends ConfigFormBase.)

  • Assigned to urvashi_vora
  • 🇮🇳India urvashi_vora Madhya Pradesh, India

    I will provide a patch asap. Assigning it to myself.

    Thanks

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India urvashi_vora Madhya Pradesh, India

    Please review the updated patch. Thanks

  • 🇺🇦Ukraine artsays

    Thank you for your contribution and for fixing class names.
    The issue also appeared with ordering in Uses namespaces.
    Attached patch and combining with fixes for both issues.

  • 🇺🇦Ukraine artsays
  • Status changed to Fixed 9 months ago
  • 🇺🇦Ukraine artsays
  • Status changed to Fixed 9 months ago
  • 🇺🇦Ukraine artsays
Production build 0.71.5 2024