Fix the issues reported by phpcs

Created on 8 January 2024, 12 months ago

Problem/Motivation

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/datetime_more/datetime_more.module
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------
8 | WARNING | [x] Unused use statement
9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Routing\RouteMatchInterface.
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/datetime_more/src/Plugin/Field/FieldWidget/DateTimeMoreDatelistWidget.php
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 75 ERRORS AND 5 WARNINGS AFFECTING 51 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldItemListInterface.
19 | ERROR | [x] There must be exactly one newline after the class comment
77 | ERROR | [ ] The array declaration extends to column 85 (the limit is 80). The array content should be split up over multiple lines
80 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 0
80 | ERROR | [x] 6 spaces found before inline comment; expected "// case '12':" but found "// case '12':"
80 | ERROR | [x] Inline comments must start with a capital letter
81 | WARNING | [ ] Line exceeds 80 characters; contains 97 characters
81 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 0
81 | ERROR | [ ] Comment indentation error, expected only 6 spaces
82 | WARNING | [x] There must be no blank line following an inline comment
82 | WARNING | [ ] There must be no blank line following an inline comment
82 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 0
82 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
88 | ERROR | [x] Newline required after opening brace
88 | ERROR | [x] There should be no white space after an opening "{"
88 | ERROR | [x] There should be no white space before a closing "}"
88 | ERROR | [x] Closing brace must be on a line by itself
89 | ERROR | [x] Newline required after opening brace
89 | ERROR | [x] There should be no white space after an opening "{"
89 | ERROR | [x] There should be no white space before a closing "}"
89 | ERROR | [x] Closing brace must be on a line by itself
90 | ERROR | [x] Newline required after opening brace
90 | ERROR | [x] There should be no white space after an opening "{"
90 | ERROR | [x] There should be no white space before a closing "}"
90 | ERROR | [x] Closing brace must be on a line by itself
91 | ERROR | [x] Newline required after opening brace
91 | ERROR | [x] There should be no white space after an opening "{"
91 | ERROR | [x] There should be no white space before a closing "}"
91 | ERROR | [x] Closing brace must be on a line by itself
92 | ERROR | [x] Newline required after opening brace
92 | ERROR | [x] There should be no white space after an opening "{"
92 | ERROR | [x] There should be no white space before a closing "}"
92 | ERROR | [x] Closing brace must be on a line by itself
93 | ERROR | [x] Newline required after opening brace
93 | ERROR | [x] There should be no white space after an opening "{"
93 | ERROR | [x] There should be no white space before a closing "}"
93 | ERROR | [x] Closing brace must be on a line by itself
107 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
110 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
111 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
113 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
114 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
119 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
124 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
133 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
142 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
151 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
160 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
169 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
178 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
182 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
186 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
187 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
188 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
193 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
197 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
199 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
200 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
202 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
205 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
206 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
208 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
209 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
210 | WARNING | [ ] Line exceeds 80 characters; contains 107 characters
210 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 0
210 | ERROR | [x] 8 spaces found before inline comment; expected "// $summary[] = $this->t('Time type: @time_type', ['@time_type' => $this->getSetting('time_type')]);" but found "// $summary[]
| | = $this->t('Time type: @time_type', ['@time_type' => $this->getSetting('time_type')]);"
211 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
212 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
213 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
214 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
215 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
216 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
217 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
218 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
219 | WARNING | [ ] Line exceeds 80 characters; contains 113 characters
219 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 0
219 | ERROR | [x] 8 spaces found before inline comment; expected "// $summary[] = $this->t('Time increments: @increment', ['@increment' => $this->getSetting('increment')]);" but found "//
| | $summary[] = $this->t('Time increments: @increment', ['@increment' => $this->getSetting('increment')]);"
220 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
222 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
223 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 74 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/datetime_more/src/Element/DatelistMore.php
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 9 ERRORS AND 7 WARNINGS AFFECTING 12 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
20 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
21 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
23 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
28 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
47 | ERROR | [ ] Long array syntax must not be used in doc comment code annotations
50 | ERROR | [ ] Long array syntax must not be used in doc comment code annotations
51 | ERROR | [ ] Long array syntax must not be used in doc comment code annotations
65 | ERROR | [ ] Description for the @return value is missing
70 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
70 | ERROR | [x] 4 spaces found before inline comment; expected "// $year_min = !empty($element['#year_min']) ? $element['#year_min'] : 1;" but found "// $year_min = !empty($element['#year_min'])
| | ? $element['#year_min'] : 1;"
71 | WARNING | [x] There must be no blank line following an inline comment
71 | WARNING | [ ] There must be no blank line following an inline comment
71 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
75 | WARNING | [ ] Unused variable $part.
103 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 0
103 | ERROR | [x] 6 spaces found before inline comment; expected "// $element['hour']['#max'] = $element['#time_type'];" but found "// $element['hour']['#max'] = $element['#time_type'];"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Time: 272ms; Memory: 12MB

Steps to reproduce

Use Phpcs command with arguments:-
./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml web/modules/custom/datetime_more

Proposed resolution

Fix all the issue reported by PHPCS

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India ashutosh ahirwal India

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.71.5 2024