Fix the issues reported by phpcs

Created on 6 April 2023, about 1 year ago
Updated 25 April 2023, about 1 year ago

Problem/Motivation

Getting the following errors/warnings.

FILE: /pager_for_content_type/pager_for_content_type.routing.yml
-------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------
 7 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than "access administration pages" which is
   |         | about viewing but not changing configurations.
-------------------------------------------------------------


FILE: /pager_for_content_type/pager_for_content_type.module
-------------------------------------------------------------
FOUND 20 ERRORS AFFECTING 17 LINES
-------------------------------------------------------------
  50 | ERROR | [x] Short array syntax must be used to define arrays
  52 | ERROR | [x] Short array syntax must be used to define arrays
  64 | ERROR | [x] Short array syntax must be used to define arrays
  66 | ERROR | [x] Short array syntax must be used to define arrays
  86 | ERROR | [x] Short array syntax must be used to define arrays
  94 | ERROR | [x] Short array syntax must be used to define arrays
 128 | ERROR | [ ] Type hint "array" missing for $pager
 132 | ERROR | [x] Short array syntax must be used to define arrays
 155 | ERROR | [x] Short array syntax must be used to define arrays
 156 | ERROR | [x] Short array syntax must be used to define arrays
 156 | ERROR | [x] Short array syntax must be used to define arrays
 162 | ERROR | [x] Short array syntax must be used to define arrays
 163 | ERROR | [x] Short array syntax must be used to define arrays
 163 | ERROR | [x] Short array syntax must be used to define arrays
 183 | ERROR | [ ] Type hint "array" missing for $node
 184 | ERROR | [x] Short array syntax must be used to define arrays
 193 | ERROR | [x] Short array syntax must be used to define arrays
 234 | ERROR | [x] Short array syntax must be used to define arrays
 235 | ERROR | [x] Short array syntax must be used to define arrays
 235 | ERROR | [x] Short array syntax must be used to define arrays
-------------------------------------------------------------------------



FILE: /pager_for_content_type/src/Form/PagerForContentTypeSettingsForm.php
-----------------------------------------------------------------------
FOUND 9 ERRORS AND 3 WARNINGS AFFECTING 12 LINES
-----------------------------------------------------------------------
  34 | WARNING | [ ] NodeType::loadMultiple calls should be avoided in classes, use dependency injection instead
  36 | ERROR   | [x] Short array syntax must be used to define arrays
  43 | ERROR   | [x] Short array syntax must be used to define arrays
  50 | ERROR   | [x] Short array syntax must be used to define arrays
  59 | ERROR   | [x] Short array syntax must be used to define arrays
  68 | ERROR   | [x] Short array syntax must be used to define arrays
  78 | ERROR   | [x] Short array syntax must be used to define arrays
  86 | ERROR   | [x] Short array syntax must be used to define arrays
  93 | ERROR   | [x] Short array syntax must be used to define arrays
 100 | ERROR   | [x] Short array syntax must be used to define arrays
 103 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 116 | WARNING | [ ] NodeType::loadMultiple calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------

Steps to reproduce

Run the following command

phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml pager_for_content_type

Proposed resolution

The above errors/warnings need to be fixe

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India omkar_yewale Mumbai

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 @omkar_yewale
  • @omkar_yewale opened merge request.
  • 🇮🇳India omkar_yewale Mumbai

    !2 MR created, Please Review.

  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • 🇺🇸United States schiavone

    @omkar_yewale phpcs is still reporting a few issues. Can you correct and update the MR?

    ILE: /var/www/html/drupal9/web/modules/contrib/pager_for_content_type/pager_for_content_type.module
    ----------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    ----------------------------------------------------------------------------------------------------
      53 | ERROR | [x] Short array syntax must be used to define arrays
     145 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
     148 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
    ----------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/drupal9/web/modules/contrib/pager_for_content_type/src/Form/PagerForContentTypeSettingsForm.php
    -------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------------------------------
     128 | ERROR | [x] Short array syntax must be used to define arrays
     138 | ERROR | [x] Short array syntax must be used to define arrays
    -------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------
    

    Thanks.

  • @schiavone opened merge request.
    • schiavone committed 5e1440b2 on 8.x-1.x
      Issue #3352593 by omkar_yewale, schiavone: Fix the issues reported by...
  • 🇺🇸United States schiavone

    Thanks @ omkar_yewale this looks good. I went ahead and rebased it.

  • Status changed to Fixed about 1 year ago
  • Status changed to Needs work about 1 year ago
  • 🇺🇸United States schiavone

    Need to resolve merge conflicts.

  • 🇺🇸United States schiavone

    Conflicts resolved and merged.

  • Status changed to Fixed about 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024