Fix the errors/warnings reported by PHP_CodeSniffer

Created on 21 November 2023, about 1 year ago
Updated 4 March 2024, 9 months ago

FILE: /opt/lampp/htdocs/drupal/web/modules/contrib/qrcode_fields/README.txt
---------------------------------------------------------------------------
FOUND 0 ERRORS AND 19 WARNINGS AFFECTING 19 LINES
---------------------------------------------------------------------------
17 | WARNING | Line exceeds 80 characters; contains 220 characters
21 | WARNING | Line exceeds 80 characters; contains 89 characters
25 | WARNING | Line exceeds 80 characters; contains 106 characters
33 | WARNING | Line exceeds 80 characters; contains 103 characters
45 | WARNING | Line exceeds 80 characters; contains 116 characters
49 | WARNING | Line exceeds 80 characters; contains 117 characters
53 | WARNING | Line exceeds 80 characters; contains 113 characters
58 | WARNING | Line exceeds 80 characters; contains 139 characters
61 | WARNING | Line exceeds 80 characters; contains 81 characters
66 | WARNING | Line exceeds 80 characters; contains 93 characters
67 | WARNING | Line exceeds 80 characters; contains 198 characters
68 | WARNING | Line exceeds 80 characters; contains 199 characters
76 | WARNING | Line exceeds 80 characters; contains 158 characters
80 | WARNING | Line exceeds 80 characters; contains 88 characters
94 | WARNING | Line exceeds 80 characters; contains 230 characters
102 | WARNING | Line exceeds 80 characters; contains 114 characters
110 | WARNING | Line exceeds 80 characters; contains 114 characters
116 | WARNING | Line exceeds 80 characters; contains 147 characters
128 | WARNING | Line exceeds 80 characters; contains 84 characters
---------------------------------------------------------------------------

FILE: /opt/lampp/htdocs/drupal/web/modules/contrib/qrcode_fields/src/Service/QRImage.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 22 ERRORS AND 12 WARNINGS AFFECTING 33 LINES
-------------------------------------------------------------------------------------------------------------------------
104 | WARNING | Only string literals should be passed to t() where possible
191 | WARNING | Only string literals should be passed to t() where possible
207 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
207 | ERROR | Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
236 | WARNING | Only string literals should be passed to t() where possible
252 | WARNING | Only string literals should be passed to t() where possible
256 | WARNING | Only string literals should be passed to t() where possible
270 | WARNING | Only string literals should be passed to t() where possible
274 | WARNING | Only string literals should be passed to t() where possible
393 | WARNING | Only string literals should be passed to t() where possible
396 | ERROR | String concat is not required here; use a single string instead
397 | ERROR | String concat is not required here; use a single string instead
398 | ERROR | String concat is not required here; use a single string instead
399 | ERROR | String concat is not required here; use a single string instead
400 | ERROR | String concat is not required here; use a single string instead
401 | ERROR | String concat is not required here; use a single string instead
402 | ERROR | String concat is not required here; use a single string instead
403 | ERROR | String concat is not required here; use a single string instead
404 | ERROR | String concat is not required here; use a single string instead
405 | ERROR | String concat is not required here; use a single string instead
406 | ERROR | String concat is not required here; use a single string instead
420 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
492 | WARNING | Only string literals should be passed to t() where possible
495 | ERROR | String concat is not required here; use a single string instead
496 | ERROR | String concat is not required here; use a single string instead
497 | ERROR | String concat is not required here; use a single string instead
498 | ERROR | String concat is not required here; use a single string instead
499 | ERROR | String concat is not required here; use a single string instead
500 | ERROR | String concat is not required here; use a single string instead
502 | ERROR | String concat is not required here; use a single string instead
505 | ERROR | String concat is not required here; use a single string instead
507 | ERROR | String concat is not required here; use a single string instead
508 | ERROR | String concat is not required here; use a single string instead
556 | WARNING | Only string literals should be passed to t() where possible
-------------------------------------------------------------------------------------------------------------------------

FILE: /opt/lampp/htdocs/drupal/web/modules/contrib/qrcode_fields/src/Plugin/Field/FieldWidget/QRFieldPhoneWidget.php
--------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------
142 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------------------------

FILE: /opt/lampp/htdocs/drupal/web/modules/contrib/qrcode_fields/src/Plugin/Field/FieldWidget/QRFieldUrlWidget.php
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------
142 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------

FILE: /opt/lampp/htdocs/drupal/web/modules/contrib/qrcode_fields/src/Plugin/Field/FieldWidget/QRFieldvCardWidget.php
--------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------------------------
43 | ERROR | Parameter $third_party_settings is not described in comment
54 | ERROR | Doc comment for parameter $third_party_settingsf does not match actual variable name $qrImage
211 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------------------------

FILE: /opt/lampp/htdocs/drupal/web/modules/contrib/qrcode_fields/src/Plugin/Field/FieldWidget/QRFieldMeCardWidget.php
---------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
---------------------------------------------------------------------------------------------------------------------
43 | ERROR | Parameter $third_party_settings is not described in comment
54 | ERROR | Doc comment for parameter $third_party_settingsf does not match actual variable name $qrImage
204 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------------------

FILE: /opt/lampp/htdocs/drupal/web/modules/contrib/qrcode_fields/src/Plugin/Field/FieldWidget/QRFieldTextWidget.php
-------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------
141 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------------------------

FILE: /opt/lampp/htdocs/drupal/web/modules/contrib/qrcode_fields/src/Plugin/Field/FieldWidget/QRFieldEventWidget.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 4 WARNINGS AFFECTING 6 LINES
-------------------------------------------------------------------------------------------------------------------------
45 | ERROR | Parameter $third_party_settings is not described in comment
56 | ERROR | Doc comment for parameter $third_party_settingsf does not match actual variable name $qrImage
115 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
175 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
190 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
225 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
225 | ERROR | Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
-------------------------------------------------------------------------------------------------------------------------

FILE: /opt/lampp/htdocs/drupal/web/modules/contrib/qrcode_fields/src/Plugin/Field/FieldWidget/QRFieldWifiWidget.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------
160 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
220 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
232 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
-----------------------------------------------------------------------------------------------------------------------

FILE: /opt/lampp/htdocs/drupal/web/modules/contrib/qrcode_fields/src/Plugin/Field/FieldWidget/QRFieldSmsWidget.php
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------
148 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------

FILE: /opt/lampp/htdocs/drupal/web/modules/contrib/qrcode_fields/src/Plugin/Field/FieldWidget/QRFieldEmailWidget.php
--------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------
167 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------------------------

FILE: /opt/lampp/htdocs/drupal/web/modules/contrib/qrcode_fields/src/Plugin/Field/FieldType/QRFieldEmail.php
------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------
54 | WARNING | Avoid backslash escaping in translatable strings when possible, use "" quotes instead
------------------------------------------------------------------------------------------------------------

FILE: /opt/lampp/htdocs/drupal/web/modules/contrib/qrcode_fields/src/Plugin/Block/QREventBlock.php
--------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------
100 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------

FILE: /opt/lampp/htdocs/drupal/web/modules/contrib/qrcode_fields/src/Plugin/Block/QRWifiBlock.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------
116 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
128 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
-----------------------------------------------------------------------------------------------------------------------

FILE: /opt/lampp/htdocs/drupal/web/modules/contrib/qrcode_fields/qrcode_fields.module
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
36 | ERROR | Invalid function name, expected format_ical_date_time but found formatICalDateTime
36 | ERROR | All functions defined in a module file must be prefixed with the module's name, found "formatICalDateTime" but expected "qrcode_fields_formatICalDateTime"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Time: 641ms; Memory: 14MB

๐Ÿ“Œ Task
Status

RTBC

Version

1.1

Component

Code

Created by

๐Ÿ‡ฒ๐Ÿ‡ผMalawi chancenyasulu

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

  • Issue created by @chancenyasulu
  • First commit to issue fork.
  • Status changed to Needs review 11 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Neha-Verma

    Fixed some PHPCS issues in MR !2, still there are \Drupal calls error that needs to be fixed.

    FILE: /opt/lampp/htdocs/camp/web/modules/contrib/QR/src/Service/QRImage.php
    ----------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------
     420 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ----------------------------------------------------------------------------------------------
    
    
    FILE: /opt/lampp/htdocs/camp/web/modules/contrib/QR/src/Plugin/Field/FieldWidget/QRFieldEventWidget.php
    -------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    -------------------------------------------------------------------------------------------------------
     115 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     175 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     190 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -------------------------------------------------------------------------------------------------------
    
    
    FILE: /opt/lampp/htdocs/camp/web/modules/contrib/QR/src/Plugin/Field/FieldWidget/QRFieldWifiWidget.php
    ------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------
     160 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ------------------------------------------------------------------------------------------------------
    
    
    FILE: /opt/lampp/htdocs/camp/web/modules/contrib/QR/src/Plugin/Field/FieldWidget/QRFieldPhoneWidget.php
    -------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------
     142 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -------------------------------------------------------------------------------------------------------
    
    
    FILE: /opt/lampp/htdocs/camp/web/modules/contrib/QR/src/Plugin/Field/FieldWidget/QRFieldEmailWidget.php
    -------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------
     167 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -------------------------------------------------------------------------------------------------------
    
    
    FILE: /opt/lampp/htdocs/camp/web/modules/contrib/QR/src/Plugin/Field/FieldWidget/QRFieldvCardWidget.php
    -------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------
     211 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -------------------------------------------------------------------------------------------------------
    
    
    FILE: /opt/lampp/htdocs/camp/web/modules/contrib/QR/src/Plugin/Field/FieldWidget/QRFieldSmsWidget.php
    -----------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------
     148 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -----------------------------------------------------------------------------------------------------
    
    
    FILE: /opt/lampp/htdocs/camp/web/modules/contrib/QR/src/Plugin/Field/FieldWidget/QRFieldUrlWidget.php
    -----------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------
     142 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -----------------------------------------------------------------------------------------------------
    
    
    FILE: /opt/lampp/htdocs/camp/web/modules/contrib/QR/src/Plugin/Field/FieldWidget/QRFieldMeCardWidget.php
    --------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------
     204 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------------------------------------
    
    
    FILE: /opt/lampp/htdocs/camp/web/modules/contrib/QR/src/Plugin/Field/FieldWidget/QRFieldTextWidget.php
    ------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------
     141 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ------------------------------------------------------------------------------------------------------
    
    
    FILE: /opt/lampp/htdocs/camp/web/modules/contrib/QR/src/Plugin/Block/QREventBlock.php
    ----------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------
     100 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ----------------------------------------------------------------------------------------------
    
    
  • Assigned to realsp
  • Status changed to Needs work 10 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia realsp

    I'll update the MR to fix the phpcs issues

  • Issue was unassigned.
  • Status changed to Needs review 10 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia realsp

    I've fixed the remaining phpcs issues mentioned in #4, Please review the MR.
    Thank you.

  • Status changed to RTBC 10 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines paraderojether

    Hi realsp,

    I reviewed MR! 2, applied against QR Code Fields 1.1.0 with Drupal core version 10.1.7, and confirmed it fixes the issue reported by phpcs.

    I added screenshots for reference.
    Thank you.

  • ๐Ÿ‡ณ๐Ÿ‡ตNepal sujan shrestha Nepal๐Ÿ‡ณ๐Ÿ‡ต, Kathmandu

    Thank you for reviewing MR! 2 and confirming the fix for the reported issue with phpcs. I'll review the fixes promptly.

Production build 0.71.5 2024