Fix the issues reported by phpcs

Created on 5 May 2023, over 1 year ago
Updated 30 October 2023, about 1 year ago

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

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/openy_mappings.links.action.yml
---------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------
10 | ERROR | [x] Expected 1 newline at end of file; 2 found
---------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/openy_mappings.module
-----------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-----------------------------------------------------------------------------------------
19 | WARNING | [ ] Do not pass empty strings to t()
48 | ERROR | [x] Short array syntax must be used to define arrays
-----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/openy_mappings.page.inc
-------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-------------------------------------------------------------------------------------------
26 | WARNING | [ ] Unused variable $mapping.
46 | ERROR | [x] Short array syntax must be used to define arrays
-------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/openy_mappings.links.task.yml
-------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------
16 | ERROR | [x] Expected 1 newline at end of file; 2 found
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/openy_mappings.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/src/LocationMappingRepository.php
---------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 6 WARNINGS AFFECTING 7 LINES
---------------------------------------------------------------------------------------------------------------------
6 | WARNING | [x] Unused use statement
7 | WARNING | [x] Unused use statement
8 | WARNING | [x] Unused use statement
9 | WARNING | [x] Unused use statement
10 | WARNING | [x] Unused use statement
14 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
39 | ERROR | [x] Data types in @param tags need to be fully namespaced
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/src/MappingInterface.php
--------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------
16 | WARNING | There must be no blank line following an inline comment
--------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/src/MappingListBuilder.php
----------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------------------------------
30 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
35 | ERROR | [x] Short array syntax must be used to define arrays
----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/src/Controller/MappingAddController.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 9 ERRORS AND 6 WARNINGS AFFECTING 15 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
7 | WARNING | [x] Unused use statement
18 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
24 | ERROR | [x] Data types in @param tags need to be fully namespaced
26 | ERROR | [x] Data types in @param tags need to be fully namespaced
38 | ERROR | [x] Data types in @var tags need to be fully namespaced
53 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
54 | WARNING | [ ] Line exceeds 80 characters; contains 117 characters
63 | ERROR | [x] Short array syntax must be used to define arrays
70 | ERROR | [x] Short array syntax must be used to define arrays
76 | ERROR | [x] Data types in @param tags need to be fully namespaced
85 | ERROR | [x] Short array syntax must be used to define arrays
86 | WARNING | [x] A comma should follow the last multiline array item. Found: )
94 | ERROR | [x] Data types in @param tags need to be fully namespaced
101 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
102 | ERROR | [x] Short array syntax must be used to define arrays
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 11 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/src/MappingRepository.php
---------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------
9 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
29 | ERROR | [x] Data types in @param tags need to be fully namespaced
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/src/Entity/MappingViewsData.php
---------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------
19 | ERROR | [x] Short array syntax must be used to define arrays
---------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/src/Entity/Mapping.php
-------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AFFECTING 9 LINES
-------------------------------------------------------------------------------------------------
69 | ERROR | [x] Short array syntax must be used to define arrays
152 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
152 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
182 | ERROR | [x] Short array syntax must be used to define arrays
187 | ERROR | [x] Short array syntax must be used to define arrays
190 | ERROR | [x] Short array syntax must be used to define arrays
203 | ERROR | [x] Short array syntax must be used to define arrays
208 | ERROR | [x] Short array syntax must be used to define arrays
213 | ERROR | [x] Short array syntax must be used to define arrays
228 | ERROR | [x] Short array syntax must be used to define arrays
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/src/MembershipTypeMappingRepository.php
---------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------
9 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
31 | ERROR | [x] Data types in @param tags need to be fully namespaced
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/src/Form/MappingTypeForm.php
---------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
---------------------------------------------------------------------------------------------------------------------
12 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
22 | ERROR | [x] Short array syntax must be used to define arrays
31 | ERROR | [x] Short array syntax must be used to define arrays
34 | ERROR | [x] Short array syntax must be used to define arrays
49 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/src/Form/MappingSettingsForm.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: /var/www/html/contribution/web/modules/contrib/openy_mappings/src/Form/MappingForm.php
-------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------
19 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
21 | WARNING | [ ] Unused variable $entity.
30 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/openy_mappings/src/Form/MappingTypeDeleteForm.php
------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------
18 | ERROR | [x] Short array syntax must be used to define arrays
------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India himanshu_jhaloya Indore

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 @himanshu_jhaloya
  • @himanshu_jhaloya opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India arpitk

    I reviewed the MR and able to verify the changes results no more phpcs errors or warnings. Please view the attached screenshot.
    Thanks!

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
       // Fetch Mapping Entity Object.
    -  $mapping = $variables['elements']['#mapping'];
    -
    +  // $mapping = $variables['elements']['#mapping'];.
    

    If a code line must be removed, it is not commented out. Also, periods are not added to commented out code because code is not a sentence.
    Furthermore, if that line is removed, also the comment about that line must be removed.

    -   * @param EntityStorageInterface $storage
    +   * @param \Drupal\Core\Entity\EntityStorageInterface $storage
        *   Entity storage.
    -   * @param EntityStorageInterface $type_storage
    +   * @param \Drupal\Core\Entity\EntityStorageInterface $type_storage
        *   Entity type storage.

    Since that documentation comment is edited, the missing articles in the parameter descriptions must be added too.

    +   *   A render array for a list of the mapping bundles/types that can be added
    +   *   or if there is only one type/bunlde defined for the site,
    +   *   the function returns the add page for that bundle/type.

    The second line has been truncated too early. (There are not rules about splitting a line at the first comma.)

     /**
    - * Class MappingTypeForm.
    + * Provides the mapping type form.
      *
      * @package Drupal\openy_mappings\Form
      */

    Provides is not necessary (in this and similar descriptions).

    - * Class MappingRepository.
    + * Provides a repository for Mapping entities.

    Only the first word in a description must be capitalized.

  • Assigned to imustakim
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India imustakim Ahmedabad

    Patch updated.
    Please review.

  • First commit to issue fork.
  • Status changed to Fixed about 1 year ago
  • 🇺🇦Ukraine podarok Ukraine

    tnx

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024