Fix the issues reported by phpcs

Created on 4 April 2023, over 1 year ago
Updated 28 April 2023, over 1 year ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/fpdi_print/fpdi_print.module
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
26 | ERROR | [x] Expected 1 blank line after function; 0 found
49 | ERROR | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/fpdi_print/src/Controller/ViewPrintController.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------
179 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
214 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/fpdi_print/src/Pdf.php
----------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------
67 | ERROR | Public method name "Pdf::Header" is not in lowerCamel format
114 | ERROR | Public method name "Pdf::Footer" is not in lowerCamel format
----------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/fpdi_print/src/PrintBuilder.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------
335 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------

Time: 2.29 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/fpdi_print/

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

Fixed

Version

1.1

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 errors/warnings has been fixed.

    Only following issue is remaining. As not aware where these function are called from.

    FILE: /var/www/html/modules/contrib/fpdi_print/src/Pdf.php
    ----------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ----------------------------------------------------------------------------
    67 | ERROR | Public method name "Pdf::Header" is not in lowerCamel format
    114 | ERROR | Public method name "Pdf::Footer" is not in lowerCamel format
    ----------------------------------------------------------------------------

    • 2b36e626 committed on 1.0.x
      Issue #3352002 by samit.310@gmail.com: Fix the issues reported by phpcs
      
  • Status changed to Fixed over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024