Fix the issues reported by phpcs

Created on 18 July 2024, 5 months ago

Problem/Motivation

Running :-
vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig web/modules/contrib/trending_topics/

returns the following warnings/errors, which should be fixed.

ILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/trending_topics/src/Plugin/Block/TrendingTopicsListBlock.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AFFECTING 5 LINES
-------------------------------------------------------------------------------------------------------------------------
53 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
53 | ERROR | [x] The closing parenthesis of a multi-line function declaration must be on a new line
62 | ERROR | [x] The first parameter of a multi-line function declaration must be on the line after the opening bracket
63 | ERROR | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 2
64 | ERROR | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 2
65 | ERROR | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 2
65 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
65 | ERROR | [x] The closing parenthesis of a multi-line function declaration must be on a new line
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/trending_topics/src/Services/TrendingTopicsService.php
---------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 1 WARNING AFFECTING 5 LINES
---------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Link.
51 | ERROR | [x] The first parameter of a multi-line function declaration must be on the line after the opening bracket
52 | ERROR | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 2
53 | ERROR | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 2
53 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
53 | ERROR | [x] The closing parenthesis of a multi-line function declaration must be on a new line
85 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------

📌 Task
Status

Active

Version

1.1

Component

Code

Created by

🇮🇳India prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan

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