Drupal Coding Standards Issues | phpcs

Created on 20 January 2023, almost 2 years ago
Updated 23 January 2023, almost 2 years ago

Problem/Motivation

Getting Following errors/warnings

$ phpcs --standard=Drupal email_contact

FILE: ...sers\Admin\Desktop\task\email_contact\src\Controller\ContactController.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found
   |       |     "\r\n"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: C:\Users\Admin\Desktop\task\email_contact\src\Form\ContactForm.php
--------------------------------------------------------------------------------
FOUND 19 ERRORS AND 2 WARNINGS AFFECTING 17 LINES
--------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
     |         |     "\r\n"
  14 | ERROR   | [x] Missing class doc comment
  16 | ERROR   | [ ] Missing member variable doc comment
  16 | ERROR   | [ ] Class property $entity_type should use lowerCamel naming
     |         |     without underscores
  17 | ERROR   | [ ] Missing member variable doc comment
  17 | ERROR   | [ ] Class property $entity_id should use lowerCamel naming
     |         |     without underscores
  18 | ERROR   | [ ] Missing member variable doc comment
  18 | ERROR   | [ ] Class property $field_name should use lowerCamel naming
     |         |     without underscores
  19 | ERROR   | [ ] Missing member variable doc comment
  19 | ERROR   | [ ] Class property $field_settings should use lowerCamel
     |         |     naming without underscores
  21 | ERROR   | [x] Missing function doc comment
  42 | ERROR   | [x] Short array syntax must be used to define arrays
  53 | ERROR   | [x] Short array syntax must be used to define arrays
  60 | ERROR   | [x] Short array syntax must be used to define arrays
  66 | ERROR   | [x] Short array syntax must be used to define arrays
  71 | ERROR   | [x] Short array syntax must be used to define arrays
 162 | WARNING | [x] 'TODO: $form_state['redirect'] = $path.' should match the
     |         |     format '@todo Fix problem X here.'
 194 | ERROR   | [ ] String concat is not required here; use a single string
     |         |     instead
 206 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
     |         |     but found "true"
 208 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
     |         |     but found "true"
 219 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: ]
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...il_contact\src\Plugin\Field\FieldFormatter\EmailContactInlineFormatter.php
--------------------------------------------------------------------------------
FOUND 19 ERRORS AFFECTING 19 LINES
--------------------------------------------------------------------------------
   1 | ERROR | [x] End of line character is invalid; expected "\n" but found
     |       |     "\r\n"
  35 | ERROR | [x] Short array syntax must be used to define arrays
  37 | ERROR | [x] Short array syntax must be used to define arrays
  40 | ERROR | [x] Short array syntax must be used to define arrays
  49 | ERROR | [x] Short array syntax must be used to define arrays
  52 | ERROR | [x] Short array syntax must be used to define arrays
  53 | ERROR | [x] Short array syntax must be used to define arrays
  54 | ERROR | [x] Short array syntax must be used to define arrays
  61 | ERROR | [x] Short array syntax must be used to define arrays
  67 | ERROR | [x] Short array syntax must be used to define arrays
  73 | ERROR | [x] Short array syntax must be used to define arrays
  79 | ERROR | [x] Short array syntax must be used to define arrays
  81 | ERROR | [x] Short array syntax must be used to define arrays
  91 | ERROR | [x] Short array syntax must be used to define arrays
 104 | ERROR | [x] Short array syntax must be used to define arrays
 113 | ERROR | [x] Short array syntax must be used to define arrays
 122 | ERROR | [ ] The array declaration extends to column 174 (the limit is
     |       |     80). The array content should be split up over multiple
     |       |     lines
 143 | ERROR | [x] Expected 1 blank line after function; 0 found
 144 | ERROR | [x] The closing brace for the class must have an empty line
     |       |     before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 18 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...mail_contact\src\Plugin\Field\FieldFormatter\EmailContactLinkFormatter.php
--------------------------------------------------------------------------------
FOUND 12 ERRORS AFFECTING 12 LINES
--------------------------------------------------------------------------------
   1 | ERROR | [x] End of line character is invalid; expected "\n" but found
     |       |     "\r\n"
  30 | ERROR | [x] Short array syntax must be used to define arrays
  32 | ERROR | [x] Short array syntax must be used to define arrays
  37 | ERROR | [x] Short array syntax must be used to define arrays
  42 | ERROR | [x] Short array syntax must be used to define arrays
  48 | ERROR | [x] Short array syntax must be used to define arrays
  54 | ERROR | [x] Short array syntax must be used to define arrays
  61 | ERROR | [x] Short array syntax must be used to define arrays
  63 | ERROR | [x] Short array syntax must be used to define arrays
  69 | ERROR | [x] Expected 1 space after "=>"; 2 found
 102 | ERROR | [x] Short array syntax must be used to define arrays
 111 | ERROR | [x] Short array syntax must be used to define arrays
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...\task\email_contact\tests\src\Functional\EmailContactLinkFormatterTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found
   |       |     "\r\n"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...l_contact\tests\src\FunctionalJavascript\EmailContactLinkFormatterTest.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found
    |       |     "\r\n"
 15 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...dmin\Desktop\task\email_contact\tests\src\Traits\EmailContactTestTrait.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found
    |       |     "\r\n"
 68 | ERROR | [x] Parameter comment must end with a full stop
 74 | ERROR | [x] Parameter comment must end with a full stop
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 538ms; Memory: 8MB

Proposed resolution

Fix the errors and warnings.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India jay jangid Jaipur

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

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