Fix the issue reported by phpcs

Created on 4 September 2023, over 1 year ago
Updated 8 July 2024, 5 months ago

Problem/Motivation
Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml show the following errors/warnings, which should be fixed when they are not false positives.

$ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml filter_by_type

FILE: C:\xampp\htdocs\drupal-10.0.0\modules\contrib\filter_by_type\filter_by_type.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
 1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
 1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
 1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\drupal-10.0.0\modules\contrib\filter_by_type\README.md
----------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------
 15 | WARNING | Line exceeds 80 characters; contains 366 characters
----------------------------------------------------------------------------


FILE: C:\xampp\htdocs\drupal-10.0.0\modules\contrib\filter_by_type\src\BatchUpdateAuthor.php
--------------------------------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 6 LINES
--------------------------------------------------------------------------------------------
 44 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
 45 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
 46 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
 83 | ERROR | [ ] Type hint "array" missing for $results
 83 | ERROR | [ ] Type hint "array" missing for $operations
 95 | ERROR | [x] Expected 1 blank line after function; 0 found
 96 | ERROR | [x] The closing brace for the class must have an empty line before it
--------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\drupal-10.0.0\modules\contrib\filter_by_type\src\Form\TypeEditForm.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 5 WARNINGS AFFECTING 11 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
  19 | WARNING | [x] Unused use statement
  20 | WARNING | [x] Unused use statement
 254 | ERROR   | [ ] The array declaration extends to column 123 (the limit is 80). The array content should be split up over multiple lines
 257 | ERROR   | [ ] The array declaration extends to column 120 (the limit is 80). The array content should be split up over multiple lines
 283 | WARNING | [x] A comma should follow the last multiline array item. Found: )
 409 | WARNING | [ ] Node::load calls should be avoided in classes, use dependency injection instead
 411 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 436 | ERROR   | [ ] The array declaration extends to column 268 (the limit is 80). The array content should be split up over multiple lines
 461 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 472 | ERROR   | [x] Expected 1 blank line after function; 0 found
 473 | ERROR   | [x] The closing brace for the class must have an empty line before it
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------

Time: 3.83 secs; Memory: 14MB

Steps to reproduce
Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml filter_by_type

๐Ÿ› Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia VijaySharma_89

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

Comments & Activities

Production build 0.71.5 2024