Drupal Coding Standards Issues | phpcs

Created on 31 January 2023, about 2 years ago
Updated 14 February 2023, about 2 years ago

Problem/Motivation

Getting Following errors/warnings

$ phpcs --standard=Drupal jslog

FILE: C:\Users\Admin\Desktop\task\jslog\js\jslog.js
--------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found
    |       |     "\r\n"
  4 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but
    |       |     found "false"
 25 | ERROR | [x] Space before opening parenthesis of function call prohibited
 49 | ERROR | [x] Expected 1 space before "?"; 0 found
 49 | ERROR | [x] Expected 1 space after "?"; 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: C:\Users\Admin\Desktop\task\jslog\src\Controller\LogController.php
--------------------------------------------------------------------------------
FOUND 5 ERRORS AND 1 WARNING AFFECTING 4 LINES
--------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
    |         |     "\r\n"
 45 | ERROR   | [x] Expected "string" but found "string." for function return
    |         |     type
 45 | ERROR   | [ ] Description for the @return value is missing
 69 | WARNING | [ ] Only string literals should be passed to t() where possible
 85 | ERROR   | [x] Expected "array" but found "array." for function return
    |         |     type
 85 | ERROR   | [ ] Description for the @return value is missing
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: C:\Users\Admin\Desktop\task\jslog\src\Form\JsLogSettingsForm.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
    |         |     "\r\n"
 59 | WARNING | [ ] Avoid backslash escaping in translatable strings when
    |         |     possible, use "" quotes instead
 71 | ERROR   | [x] Expected 1 blank line after function; 2 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 473ms; Memory: 8MB

Proposed resolution

Fix the errors and warnings.

📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

🇮🇳India jay jangid Jaipur

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

Comments & Activities

Production build 0.71.5 2024