Problem/Motivation
Getting following error/warnings
FILE: /app/modules/contrib/workbench_email/src/EventSubscriber/ContentModerationStateChangedEvent.php
-----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
32 | ERROR | [x] Expected "string|false" but found "string|FALSE" for @var tag in member variable comment
-----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/src/EventSubscriber/WorkbenchTransitionEventSubscriber.php
-----------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
57 | ERROR | Type hint "\Drupal\content_moderation\Event\ContentModerationStateChangedEvent" missing for $event
-----------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/src/Form/TemplateForm.php
------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 3 WARNINGS AFFECTING 5 LINES
------------------------------------------------------------------------------------------------------------------------
18 | WARNING | [x] Unused use statement
26 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
71 | ERROR | [ ] Parameter $module_handler is not described in comment
71 | ERROR | [ ] Parameter $messenger is not described in comment
83 | ERROR | [ ] Type hint "\Drupal\content_moderation\ModerationInformationInterface" missing for $moderation_info
285 | WARNING | [ ] Workflow::loadMultiple calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/src/Plugin/Derivative/WorkbenchEmailDeriver.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------
28 | ERROR | [x] Do not append variable name "$moderation_information" to the type declaration in a member variable comment
40 | ERROR | [ ] Type hint "\Drupal\content_moderation\ModerationInformationInterface" missing for $moderation_info
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/src/Plugin/QueueWorker/WorkbenchEmailProcessor.php
---------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------
126 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
---------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/src/Plugin/RecipientType/EmailField.php
----------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------------------------------
69 | ERROR | [ ] Type hint "\Drupal\content_moderation\ModerationInformationInterface" missing for $moderation_info
141 | ERROR | [x] list(...) is forbidden, use [...] instead.
145 | ERROR | [x] list(...) is forbidden, use [...] instead.
168 | ERROR | [x] list(...) is forbidden, use [...] instead.
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/src/Plugin/RecipientType/FixedEmail.php
----------------------------------------------------------------------------------
FOUND 1 ERROR AND 5 WARNINGS AFFECTING 6 LINES
----------------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
7 | WARNING | [x] Unused use statement
9 | WARNING | [x] Unused use statement
10 | WARNING | [x] Unused use statement
13 | WARNING | [x] Unused use statement
16 | ERROR | [x] Doc comment short description must end with a full stop
----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/src/Plugin/RecipientType/RolesWithAccess.php
----------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 3 WARNINGS AFFECTING 7 LINES
----------------------------------------------------------------------------------------
6 | WARNING | [x] Unused use statement
8 | WARNING | [x] Unused use statement
9 | WARNING | [x] Unused use statement
10 | ERROR | [x] There must be one blank line after the last USE statement; 2 found;
24 | ERROR | [x] There must be exactly one newline after the class comment
53 | ERROR | [x] Expected 1 blank line after function; 0 found
54 | ERROR | [x] The closing brace for the class must have an empty line before it
----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/src/Plugin/RecipientTypeBase.php
---------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------
38 | WARNING | Line exceeds 80 characters; contains 84 characters
---------------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/src/Plugin/RecipientTypeInterface.php
-------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------
17 | WARNING | [x] 'TODO Docs.' should match the format '@todo Fix problem X here.'
-------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/src/RecipientTypePluginCollection.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
26 | WARNING | Possible useless method overriding detected
--------------------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/src/TemplateInterface.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
99 | WARNING | Line exceeds 80 characters; contains 104 characters
----------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/tests/src/Functional/WorkbenchEmailTest.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
------------------------------------------------------------------------------------------------------------------------------------------
302 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
336 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
348 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
370 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/tests/src/Kernel/ConfigDependenciesTest.php
--------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------
67 | WARNING | Unused variable $node_type.
--------------------------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/tests/src/Kernel/RecipientTypePluginsTest.php
----------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------
85 | WARNING | Unused variable $node_type.
----------------------------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/workbench_email.module
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
73 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for
| | xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
82 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for
| | xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
100 | ERROR | [x] Additional blank lines found at end of doc comment
101 | ERROR | [ ] Expected type hint "EntityInterface"; found "ContentModerationState" for $entity
113 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/workbench_email/workbench_email.post_update.php
--------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 1 LINE
--------------------------------------------------------------------------
41 | ERROR | [x] There should be no white space after an opening "{"
41 | ERROR | [x] There should be no white space before a closing "}"
41 | ERROR | [x] Closing brace must be on a line by itself
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------
Time: 7.6 secs; 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/workbench_email/
Proposed resolution
Above error/warnings need to be fixed
Note:
I also removed public function &get($instance_id)
function from
workbench_email/src/RecipientTypePluginCollection.php file
as it is only called it's parent get function.