Fix the errors/warnings reported by PHP_CodeSniffer

Created on 18 January 2024, 10 months ago
Updated 13 May 2024, 7 months ago

Problem/Motivation

When running the module code against Drupal coding standards based on Drupal standard, the module shows errors

Steps to reproduce

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

Report:

FILE: /home/contribution/drupal/web/modules/contrib/invoicexpress_api/invoicexpress_api.services.yml
--------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------
 13 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/invoicexpress_api/src/InvoicExpressEstimatesService.php
---------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 14 WARNINGS AFFECTING 14 LINES
---------------------------------------------------------------------------------------------------------------------
  86 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  96 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 121 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 130 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 187 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 197 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 230 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 240 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 265 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 275 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 299 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 308 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 347 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 357 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/invoicexpress_api/src/InvoicExpressClientsService.php
-------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 14 WARNINGS AFFECTING 14 LINES
-------------------------------------------------------------------------------------------------------------------
  56 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  65 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  87 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  96 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 135 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 145 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 186 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 196 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 218 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 227 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 249 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 258 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 293 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 303 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/invoicexpress_api/src/InvoicExpressSequencesService.php
---------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------
 52 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 61 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/invoicexpress_api/src/InvoicExpressInvoicesService.php
--------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 16 WARNINGS AFFECTING 16 LINES
--------------------------------------------------------------------------------------------------------------------
  88 | 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
 155 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 165 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 189 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 198 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 220 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 229 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 254 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 264 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 300 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 310 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 350 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 360 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 384 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 393 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/invoicexpress_api/invoicexpress_api.module
------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------------
 21 | ERROR | All functions defined in a module file must be prefixed with the module's name, found "invoicexpress_handle_response" but expected
    |       | "invoicexpress_api_invoicexpress_handle_response"
------------------------------------------------------------------------------------------------------------------------------------------------------------

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India realsp

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024