Fix the errors/warnings reported by PHP_CodeSniffer

Created on 1 December 2022, almost 2 years ago
Updated 22 June 2024, 5 months ago

Problem/Motivation

Getting following error/warnings

FILE: /app/modules/contrib/leaflet_more_maps/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
26 | WARNING | Line exceeds 80 characters; contains 81 characters
45 | WARNING | Line exceeds 80 characters; contains 115 characters
----------------------------------------------------------------------

FILE: /app/modules/contrib/leaflet_more_maps/leaflet_demo/src/Form/LeafletDemoForm.php
---------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------
13 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
88 | ERROR | [x] Use null coalesce operator instead of ternary operator.
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------

FILE: /app/modules/contrib/leaflet_more_maps/leaflet_more_maps.api.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
9 | WARNING | Line exceeds 80 characters; contains 91 characters
----------------------------------------------------------------------

FILE: /app/modules/contrib/leaflet_more_maps/leaflet_more_maps.module
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 58 ERRORS AND 6 WARNINGS AFFECTING 55 LINES
--------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
2 | ERROR | [x] You must use "/**" style comments for a file comment
11 | WARNING | [ ] Global constants should not be used, move it to a class or interface
18 | WARNING | [ ] Hook implementations should not duplicate @return documentation
18 | ERROR | [ ] Description for the @return value must be on the next line
35 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
80 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
222 | ERROR | [x] Closing parenthesis of array declaration must be on a new line
272 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
280 | ERROR | [x] No space found before comment text; expected "// 'Outdoors'," but found "//'Outdoors',"
282 | WARNING | [x] A comma should follow the last multiline array item. Found: 'Streets'
288 | ERROR | [x] Case breaking statements must be followed by a single blank line
291 | ERROR | [x] Case breaking statements must be followed by a single blank line
294 | ERROR | [x] Case breaking statements must be followed by a single blank line
297 | ERROR | [x] Case breaking statements must be followed by a single blank line
299 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
323 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
386 | ERROR | [x] Concat operator must be surrounded by a single space
398 | ERROR | [x] Concat operator must be surrounded by a single space
410 | ERROR | [x] Concat operator must be surrounded by a single space
422 | ERROR | [x] Concat operator must be surrounded by a single space
434 | ERROR | [x] Concat operator must be surrounded by a single space
440 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
441 | ERROR | [x] Expected 1 space before "="; 0 found
449 | ERROR | [x] Array indentation error, expected 8 spaces but found 9
458 | ERROR | [x] No space found before comment text; expected "// 'Toner'," but found "//'Toner',"
473 | ERROR | [x] Expected 1 space between "'maxZoom'" and double arrow; 0 found
473 | ERROR | [x] Expected 1 space before "=>"; 0 found
486 | ERROR | [x] Inline comments must start with a capital letter
486 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
486 | ERROR | [x] Comments may not appear after statements
487 | ERROR | [x] Inline comments must start with a capital letter
487 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
487 | ERROR | [x] Comments may not appear after statements
488 | ERROR | [x] Inline comments must start with a capital letter
488 | ERROR | [x] Comments may not appear after statements
508 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
510 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
511 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
512 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
513 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
514 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
515 | WARNING | [ ] Line exceeds 80 characters; contains 89 characters
515 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 8
516 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 8
517 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 10
518 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 10
519 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 8
520 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
521 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
523 | ERROR | [x] Line indented incorrectly; expected 3 spaces, found 2
561 | ERROR | [x] Short array syntax must be used to define arrays
567 | ERROR | [ ] Missing parameter comment
568 | ERROR | [ ] Missing parameter comment
569 | ERROR | [ ] Missing parameter comment
570 | ERROR | [ ] Missing parameter comment
571 | ERROR | [ ] Missing parameter comment
573 | ERROR | [ ] Type hint "false" missing for $reverse_order
573 | ERROR | [x] Incorrect spacing between default value and equals sign for argument "$default_settings"; expected 1 but found 2
580 | ERROR | [x] Expected 1 space after "=>"; 2 found
604 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
605 | ERROR | [x] There must be exactly one blank line before the tags in a doc comment
629 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
634 | ERROR | [x] Array closing indentation error, expected 4 spaces but found 6
--------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 52 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------

FILE: /app/modules/contrib/leaflet_more_maps/leaflet_more_maps.routing.yml
--------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------
7 | ERROR | [x] Expected 1 newline at end of file; 2 found
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------

FILE: /app/modules/contrib/leaflet_more_maps/src/Form/SettingsForm.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
33 | ERROR | Missing parameter comment
34 | ERROR | Missing parameter comment
----------------------------------------------------------------------

Time: 328ms; Memory: 14MB

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/leaflet_more_maps/

Proposed resolution

Above error need to be fixed

๐Ÿ“Œ Task
Status

Fixed

Version

2.1

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

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

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024