Drupal Coding Standards Issues | phpcs

Created on 7 February 2023, almost 2 years ago
Updated 12 February 2023, almost 2 years ago

Problem/Motivation

FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/engagebay/engagebay.module
---------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 1 WARNING AFFECTING 6 LINES
---------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] Missing file doc comment
  7 | WARNING | [x] Unused use statement
  9 | ERROR   | [x] Missing function doc comment
 10 | ERROR   | [x] Opening brace should be on the same line as the declaration
 31 | ERROR   | [x] Opening brace should be on the same line as the declaration
 39 | ERROR   | [x] Concat operator must be surrounded by a single space
 39 | ERROR   | [x] Concat operator must be surrounded by a single space
 39 | ERROR   | [x] Concat operator must be surrounded by a single space
---------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/engagebay/engagebay.install
----------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 1 WARNING AFFECTING 4 LINES
----------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] Missing file doc comment
 11 | WARNING | [ ] Unused variable $forms_plugin_detected.
 30 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 35 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 35 | ERROR   | [x] Closing brace indented incorrectly; expected 4 spaces, found 6
----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/engagebay/src/Form/EngageBayLandingPageDialog.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 15 ERRORS AND 5 WARNINGS AFFECTING 17 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
 15 | ERROR   | [x] Missing class doc comment
 16 | ERROR   | [x] Opening brace should be on the same line as the declaration
 17 | ERROR   | [x] Missing function doc comment
 17 | ERROR   | [x] Expected 1 blank line before function; 0 found
 18 | ERROR   | [x] Opening brace should be on the same line as the declaration
 22 | ERROR   | [x] Missing function doc comment
 23 | ERROR   | [x] Opening brace should be on the same line as the declaration
 28 | ERROR   | [x] Missing function doc comment
 28 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
 29 | ERROR   | [x] Opening brace should be on the same line as the declaration
 32 | WARNING | [x] There must be no blank line following an inline comment
 32 | WARNING | [ ] There must be no blank line following an inline comment
 41 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 45 | WARNING | [x] A comma should follow the last multiline array item. Found: 'width: 300px'
 46 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 66 | ERROR   | [x] Missing function doc comment
 67 | ERROR   | [x] Opening brace should be on the same line as the declaration
 77 | ERROR   | [x] Expected newline after closing brace
 93 | ERROR   | [x] Missing function doc comment
 94 | ERROR   | [x] Opening brace should be on the same line as the declaration
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 18 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/engagebay/src/Form/EngageBayConfigurationForm.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 22 ERRORS AND 8 WARNINGS AFFECTING 27 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
   2 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
   9 | ERROR   | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
  13 | WARNING | [x] Unused use statement
  16 | ERROR   | [x] Missing class doc comment
  17 | ERROR   | [x] Opening brace should be on the same line as the declaration
  20 | ERROR   | [x] Missing function doc comment
  21 | ERROR   | [x] Opening brace should be on the same line as the declaration
  25 | ERROR   | [x] Missing function doc comment
  26 | ERROR   | [x] Opening brace should be on the same line as the declaration
  33 | ERROR   | [x] Expected newline after closing brace
  33 | ERROR   | [x] Use "elseif" in place of "else if"
  41 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  41 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
  42 | WARNING | [x] A comma should follow the last multiline array item. Found: TRUE
  47 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  47 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
  48 | WARNING | [x] A comma should follow the last multiline array item. Found: TRUE
  55 | WARNING | [x] A comma should follow the last multiline array item. Found: 'primary'
  61 | ERROR   | [x] Missing function doc comment
  62 | ERROR   | [x] Opening brace should be on the same line as the declaration
  72 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
  76 | ERROR   | [x] Missing function doc comment
  77 | ERROR   | [x] Opening brace should be on the same line as the declaration
  85 | ERROR   | [x] Expected newline after closing brace
  93 | ERROR   | [x] Missing function doc comment
  94 | ERROR   | [x] Opening brace should be on the same line as the declaration
  95 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
  97 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 100 | ERROR   | [x] Expected 1 blank line after function; 0 found
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 26 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/engagebay/src/Form/EngageBayFormDialog.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 15 ERRORS AND 5 WARNINGS AFFECTING 17 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
 15 | ERROR   | [x] Missing class doc comment
 16 | ERROR   | [x] Opening brace should be on the same line as the declaration
 17 | ERROR   | [x] Missing function doc comment
 17 | ERROR   | [x] Expected 1 blank line before function; 0 found
 18 | ERROR   | [x] Opening brace should be on the same line as the declaration
 22 | ERROR   | [x] Missing function doc comment
 23 | ERROR   | [x] Opening brace should be on the same line as the declaration
 28 | ERROR   | [x] Missing function doc comment
 28 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
 29 | ERROR   | [x] Opening brace should be on the same line as the declaration
 32 | WARNING | [x] There must be no blank line following an inline comment
 32 | WARNING | [ ] There must be no blank line following an inline comment
 41 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 45 | WARNING | [x] A comma should follow the last multiline array item. Found: 'width: 300px'
 46 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 66 | ERROR   | [x] Missing function doc comment
 67 | ERROR   | [x] Opening brace should be on the same line as the declaration
 77 | ERROR   | [x] Expected newline after closing brace
 93 | ERROR   | [x] Missing function doc comment
 94 | ERROR   | [x] Opening brace should be on the same line as the declaration
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 18 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/engagebay/src/Plugin/CKEditorPlugin/LandingPage.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 14 ERRORS AND 5 WARNINGS AFFECTING 17 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
  5 | WARNING | [x] Unused use statement
  5 | ERROR   | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
 21 | ERROR   | [x] Opening brace should be on the same line as the declaration
 22 | ERROR   | [x] Missing function doc comment
 22 | ERROR   | [x] Expected 1 blank line before function; 0 found
 23 | ERROR   | [x] Opening brace should be on the same line as the declaration
 27 | ERROR   | [x] Missing function doc comment
 33 | ERROR   | [x] Missing function doc comment
 34 | ERROR   | [x] Opening brace should be on the same line as the declaration
 36 | WARNING | [x] A comma should follow the last multiline array item. Found: )
 40 | ERROR   | [x] Missing function doc comment
 41 | ERROR   | [x] Opening brace should be on the same line as the declaration
 42 | ERROR   | [x] Expected 1 space after "="; 2 found
 46 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 47 | WARNING | [x] A comma should follow the last multiline array item. Found: $iconImage
 48 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 52 | ERROR   | [x] Missing function doc comment
 53 | ERROR   | [x] Opening brace should be on the same line as the declaration
 58 | ERROR   | [x] Expected 1 blank line after function; 0 found
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 18 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/engagebay/src/Plugin/CKEditorPlugin/Form.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 14 ERRORS AND 5 WARNINGS AFFECTING 17 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
  5 | WARNING | [x] Unused use statement
  5 | ERROR   | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
 21 | ERROR   | [x] Opening brace should be on the same line as the declaration
 22 | ERROR   | [x] Missing function doc comment
 22 | ERROR   | [x] Expected 1 blank line before function; 0 found
 23 | ERROR   | [x] Opening brace should be on the same line as the declaration
 27 | ERROR   | [x] Missing function doc comment
 33 | ERROR   | [x] Missing function doc comment
 34 | ERROR   | [x] Opening brace should be on the same line as the declaration
 36 | WARNING | [x] A comma should follow the last multiline array item. Found: )
 40 | ERROR   | [x] Missing function doc comment
 41 | ERROR   | [x] Opening brace should be on the same line as the declaration
 42 | ERROR   | [x] Expected 1 space after "="; 2 found
 46 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 47 | WARNING | [x] A comma should follow the last multiline array item. Found: $iconImage
 48 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 52 | ERROR   | [x] Missing function doc comment
 53 | ERROR   | [x] Opening brace should be on the same line as the declaration
 58 | ERROR   | [x] Expected 1 blank line after function; 0 found
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 18 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/engagebay/src/Controller/EngageBayController.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 2 WARNINGS AFFECTING 9 LINES
-------------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
  6 | ERROR   | [x] Missing class doc comment
  7 | ERROR   | [x] Opening brace should be on the same line as the declaration
  8 | ERROR   | [x] Missing function doc comment
  8 | ERROR   | [x] Expected 1 blank line before function; 0 found
  9 | ERROR   | [x] Opening brace should be on the same line as the declaration
 10 | ERROR   | [x] Short array syntax must be used to define arrays
 12 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 14 | WARNING | [x] A comma should follow the last multiline array item. Found:         </a>'
 16 | ERROR   | [x] Expected 1 blank line after function; 0 found
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/engagebay/src/Service/EngageBayAPI.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 85 ERRORS AND 4 WARNINGS AFFECTING 67 LINES
-------------------------------------------------------------------------------------------------------------------------------------------
  5 | ERROR   | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
  6 | ERROR   | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
  9 | ERROR   | [x] Missing class doc comment
 10 | ERROR   | [x] Opening brace should be on the same line as the declaration
 11 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 12 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 14 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 14 | ERROR   | [ ] Missing member variable doc comment
 16 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 16 | ERROR   | [ ] Missing member variable doc comment
 18 | WARNING | [x] A comma should follow the last multiline array item. Found: 'application/json'
 21 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 21 | ERROR   | [x] Missing function doc comment
 21 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
 22 | ERROR   | [x] Opening brace should be on the same line as the declaration
 23 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 25 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 26 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
 27 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 28 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 30 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 30 | ERROR   | [x] Missing function doc comment
 31 | ERROR   | [x] Opening brace should be on the same line as the declaration
 32 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 33 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 35 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 35 | ERROR   | [ ] The array declaration extends to column 89 (the limit is 80). The array content should be split up over multiple lines
 35 | ERROR   | [x] Comma not allowed after last value in single-line array declaration
 35 | ERROR   | [x] Expected one space after the comma, 0 found
 37 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 37 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 38 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 40 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 40 | ERROR   | [x] Missing function doc comment
 41 | ERROR   | [x] Opening brace should be on the same line as the declaration
 42 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 43 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 45 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 45 | ERROR   | [x] Missing function doc comment
 46 | ERROR   | [x] Opening brace should be on the same line as the declaration
 47 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 48 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 50 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 50 | ERROR   | [x] Missing function doc comment
 51 | ERROR   | [x] Opening brace should be on the same line as the declaration
 52 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 53 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 55 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 55 | ERROR   | [x] Missing function doc comment
 56 | ERROR   | [x] Opening brace should be on the same line as the declaration
 57 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 58 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 60 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 60 | ERROR   | [x] Missing function doc comment
 61 | ERROR   | [x] Opening brace should be on the same line as the declaration
 62 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 63 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 65 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 65 | ERROR   | [x] Missing function doc comment
 66 | ERROR   | [x] Opening brace should be on the same line as the declaration
 67 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 68 | WARNING | [ ] Unused variable $body_key.
 68 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
 69 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 69 | ERROR   | [x] Expected newline after closing brace
 70 | WARNING | [ ] Unused variable $body_key.
 70 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
 71 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 73 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 74 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
 76 | WARNING | [x] A comma should follow the last multiline array item. Found: $data
 79 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 12
 80 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 12
 81 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 16
 82 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 12
 84 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 84 | ERROR   | [x] Expected newline after closing brace
 85 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
 86 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 88 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 88 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
 89 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 91 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 91 | ERROR   | [x] Missing function doc comment
 92 | ERROR   | [x] Opening brace should be on the same line as the declaration
 93 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 95 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 96 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 96 | ERROR   | [x] Expected 1 blank line after function; 0 found
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 84 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/engagebay/src/Service/EngageBayAPIInterface.php
------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------
 5 | ERROR | [x] Missing interface doc comment
 6 | ERROR | [x] Opening brace should be on the same line as the declaration
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

Time: 151ms; Memory: 10MB

Steps to reproduce

Run the following command: phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml /modules/contrib/engagebay

Proposed resolution

Fix all the PHP coding standard issues.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India sahil.goyal

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

Comments & Activities

Production build 0.71.5 2024