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.
| Comment | File | Size | Author |
|---|
Issue fork workbench_email-3328490
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
samitk commentedError/warnings are fixed.
Comment #3
mstrelan commentedContrib modules are free to opt-in to their own coding standards. Nevertheless here's a review.
We may need to be careful to not break downstream modules extending this class, although I think that is unlikely.
🤷
I'd rather remove these annotations entirely. The parameters are already typed and the description gives no further information about them.
Once we can drop PHP 7 support we can convert to constructor property promotion as well.
As per previous comment on backwards compatibility.
How about reducing it to just "An associative array of configured settings for this recipient type".
This is superfluous.
Not sure what was wrong with this one.
As above
Comment #4
anoopsingh92Comment #5
anoopsingh92Please review the patch.
Comment #6
anoopsingh92I have made all the necessary changes manually, I didn't run phpcbf for these coding standards fixed.
Comment #7
gaurav-mathur commentedComment #8
gaurav-mathur commentedI tested patch #5 and it applied cleanly for drupal 10.0.0-dev.
Patch did not work properly ,still seeing some errors/warnings in above files.
Please re-roll the patch.
Thank you.
Comment #9
anoopsingh92@gaurav-mathur, Thanks for the review the patch.
I have made my changes as per the standard. Other issues are automatically fixed when you will run phpcbf and those issues will not be reflected in the patch also. those changes are only for /n and /r/n nothing else.
I have mentioned in #6 also I have made manually all these issues and didn't run phpcbf for fixing coding standard issues. If you are still seeing any issues please mention them in the comment.
Thank you.
Comment #10
avpadernoShort descriptions must be only a line.
What follows
@todois a sentence. Docs. does not say much about what needs to be done.nodeTypeis not a valid PHP type and it cannot be used with@var.I am not sure the fact
phpcbfcan fix some warnings/errors is a valid reason not to change those lines in the patch. Maintainers are not supposed to apply the patch and then runphpcbf; they are supposed to apply the patch, or merge the MR.Comment #11
arpitk commentedUpdating patch with reference to #10
Comment #12
arpitk commentedTried the patch #5 it failed with 3.x-dev. However it works with 3.0.0. Updated the patch with reference from #10. Please review.
Thanks!
Comment #13
nikolay shapovalov commentedComment #16
ankitv18 commentedPHPCS job is fixed : https://git.drupalcode.org/issue/workbench_email-3328490/-/jobs/1715887
Please review the MR!24
Comment #17
cleavinjosh commentedHi @ankitv18,
I applied MR!24, it was applied smoothly and fixed all phpcs issues.
Thank you.
Comment #18
larowlanThanks will look at this later in the week
Comment #19
larowlanThanks folks, left a review on the MR
Comment #20
ankitv18 commentedComment #21
ankitv18 commentedWill rebase with dev branch and check for further phpcs report & do a suggested fix.
Comment #23
larowlanComment #24
ankitv18 commented