Fix coding standards issues

Created on 12 May 2011, over 13 years ago
Updated 19 October 2023, about 1 year ago

Make the code follow Drupal coding standards.

📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

🇩🇪Germany jpl-2

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

    This fixes everything except implementing dependency injection.

  • Status changed to Needs work about 1 year ago
  • 🇮🇳India mrinalini9 New Delhi

    Reviewed patch #2, looks good to me.

    It applied cleanly and fixed the phpcs issues except the below issues that need to be fixed as well:

    FILE: /tac_lite/src/Form/UserAccessForm.php
    ---------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
    ---------------------------------------------------------------------------------------------------------------
      40 | WARNING | Vocabulary::loadMultiple calls should be avoided in classes, use dependency injection instead
      41 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
      63 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
      98 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     103 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ---------------------------------------------------------------------------------------------------------------
    
    
    FILE: /tac_lite/src/Form/SchemeForm.php
    ---------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    ---------------------------------------------------------------------------------------------------------------
      98 | WARNING | Vocabulary::loadMultiple calls should be avoided in classes, use dependency injection instead
     184 | ERROR   | Type hint "array" missing for $default_values
    ---------------------------------------------------------------------------------------------------------------
    
    
    FILE: /tac_lite/src/Form/ConfigForm.php
    ---------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    ---------------------------------------------------------------------------------------------------------------
      33 | WARNING | Vocabulary::loadMultiple calls should be avoided in classes, use dependency injection instead
      89 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     109 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ---------------------------------------------------------------------------------------------------------------
    
    
    FILE: /tac_lite/src/Cache/TacLiteGrantsCacheContext.php
    ---------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------
     78 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ---------------------------------------------------------------------------------------------------------
    

    Please fix these issues as well.

    Thanks!

  • Status changed to Needs review about 1 year ago
  • 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

    This patch adds the array type declaration.

    Implementing dependency injection is far more complicated. It should to be done in a separate ticket.

  • 🇬🇧United Kingdom schillerm

    Hi, I ran phpcs against patch #4 and got back just dependency injection warnings ..

    ###############################################
    👻️ ~/Documents/Sites/D9.5.0  phpcs --standard=Drupal,DrupalPractice --ignore=PATCHES.txt --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml web/modules/contrib/tac_lite

    FILE: /home/user/Documents/Sites/D9.5.0/web/modules/contrib/tac_lite/src/Form/SchemeForm.php
    --------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------
    98 | WARNING | Vocabulary::loadMultiple calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------------------------------------------

    FILE: /home/user/Documents/Sites/D9.5.0/web/modules/contrib/tac_lite/src/Form/ConfigForm.php
    ---------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    ---------------------------------------------------------------------------------------------------------------
    33 | WARNING | Vocabulary::loadMultiple calls should be avoided in classes, use dependency injection instead
    89 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    109 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ---------------------------------------------------------------------------------------------------------------

    FILE: /home/user/Documents/Sites/D9.5.0/web/modules/contrib/tac_lite/src/Form/UserAccessForm.php
    ---------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
    ---------------------------------------------------------------------------------------------------------------
    40 | WARNING | Vocabulary::loadMultiple calls should be avoided in classes, use dependency injection instead
    41 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    63 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    98 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    103 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ---------------------------------------------------------------------------------------------------------------

    FILE: /home/user/Documents/Sites/D9.5.0/web/modules/contrib/tac_lite/src/Cache/TacLiteGrantsCacheContext.php
    ------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------
    78 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ------------------------------------------------------------------------------------------------------------------

    Time: 140ms; Memory: 10MB
    ######################################

    If we ignore dependency injection warnings then this gets +1 for RTBC from me.

  • 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

    Thanks @schillerm. Please switch the status to RTBC.

    Created 📌 Use dependency injection Active .

Production build 0.71.5 2024