Fix the issue reported by PHPCS

Created on 10 October 2023, 9 months ago
Updated 11 October 2023, 9 months ago

Problem/Motivation

FILE: ...e/ghostman-zibbi/Desktop/work/Test site/web/modules/contrib/advance_script_manager/src/Form/ScriptsOrderForm.php
----------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------
149 | WARNING | Unused variable $result.
156 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------------------------------

FILE: .../ghostman-zibbi/Desktop/work/Test site/web/modules/contrib/advance_script_manager/src/Form/SearchscriptsForm.php
----------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
----------------------------------------------------------------------------------------------------------------------
66 | WARNING | Unused variable $visibility.
74 | ERROR | Comment indentation error, expected only 1 spaces
77 | ERROR | Comment indentation error, expected only 3 spaces
----------------------------------------------------------------------------------------------------------------------

FILE: ...me/ghostman-zibbi/Desktop/work/Test site/web/modules/contrib/advance_script_manager/src/Form/ListscriptsForm.php
----------------------------------------------------------------------------------------------------------------------
FOUND 36 ERRORS AND 4 WARNINGS AFFECTING 34 LINES
----------------------------------------------------------------------------------------------------------------------
101 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
102 | ERROR | [x] Whitespace found at end of line
120 | WARNING | [x] A comma should follow the last multiline array item. Found: 'primary'
127 | WARNING | [x] A comma should follow the last multiline array item. Found: 'danger'
129 | ERROR | [x] Whitespace found at end of line
137 | WARNING | [ ] Unused variable $key.
196 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
196 | ERROR | [x] Object operator not indented correctly; expected 10 spaces but found 8
199 | ERROR | [x] Array closing indentation error, expected 8 spaces but found 10
200 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
201 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
206 | ERROR | [x] Whitespace found at end of line
209 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
209 | ERROR | [x] Object operator not indented correctly; expected 10 spaces but found 8
212 | ERROR | [x] Array closing indentation error, expected 8 spaces but found 10
213 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
214 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
222 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
222 | ERROR | [x] Object operator not indented correctly; expected 10 spaces but found 8
225 | ERROR | [x] Array closing indentation error, expected 8 spaces but found 10
226 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
227 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
232 | ERROR | [x] Whitespace found at end of line
235 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
235 | ERROR | [x] Object operator not indented correctly; expected 10 spaces but found 8
238 | ERROR | [x] Array closing indentation error, expected 8 spaces but found 10
239 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
240 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
245 | ERROR | [x] Whitespace found at end of line
248 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
248 | ERROR | [x] Object operator not indented correctly; expected 10 spaces but found 8
251 | ERROR | [x] Array closing indentation error, expected 8 spaces but found 10
252 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
253 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
258 | ERROR | [x] Whitespace found at end of line
260 | ERROR | [x] Perl-style comments are not allowed; use "// Comment" instead
262 | ERROR | [x] Whitespace found at end of line
263 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
263 | ERROR | [x] Whitespace found at end of line
277 | ERROR | [x] Expected one space after the comma, 0 found
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 38 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------

FILE: /home/ghostman-zibbi/Desktop/work/Test site/web/modules/contrib/advance_script_manager/src/Form/ScriptsForm.php
---------------------------------------------------------------------------------------------------------------------
FOUND 14 ERRORS AND 2 WARNINGS AFFECTING 16 LINES
---------------------------------------------------------------------------------------------------------------------
79 | WARNING | [ ] Unused variable $config.
86 | ERROR | [x] Use null coalesce operator instead of ternary operator.
96 | ERROR | [x] Use null coalesce operator instead of ternary operator.
103 | ERROR | [x] Use null coalesce operator instead of ternary operator.
110 | ERROR | [x] Use null coalesce operator instead of ternary operator.
113 | ERROR | [x] Short array syntax must be used to define arrays
117 | ERROR | [x] Short array syntax must be used to define arrays
132 | ERROR | [x] Use null coalesce operator instead of ternary operator.
134 | ERROR | [x] Short array syntax must be used to define arrays
144 | ERROR | [x] Use null coalesce operator instead of ternary operator.
153 | ERROR | [x] Use null coalesce operator instead of ternary operator.
155 | ERROR | [x] Short array syntax must be used to define arrays
167 | ERROR | [x] Short array syntax must be used to define arrays
180 | ERROR | [x] Whitespace found at end of line
184 | ERROR | [x] Expected 1 space after "=>"; 2 found
238 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 14 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------

Time: 313ms; Memory: 12MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig random_frontpage/

Proposed resolution

Fix all the issues reported for Drupal and DrupalPractice standards

๐Ÿ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia kalash-j jaipur

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

Production build 0.69.0 2024