Problem/Motivation
Getting following error/warnings
FILE: /app/modules/contrib/content_moderation_notifications/README.txt
----------------------------------------------------------------------
FOUND 0 ERRORS AND 7 WARNINGS AFFECTING 7 LINES
----------------------------------------------------------------------
50 | WARNING | Line exceeds 80 characters; contains 85 characters
75 | WARNING | Line exceeds 80 characters; contains 100 characters
84 | WARNING | Line exceeds 80 characters; contains 104 characters
85 | WARNING | Line exceeds 80 characters; contains 87 characters
87 | WARNING | Line exceeds 80 characters; contains 105 characters
93 | WARNING | Line exceeds 80 characters; contains 99 characters
94 | WARNING | Line exceeds 80 characters; contains 94 characters
----------------------------------------------------------------------
FILE: /app/modules/contrib/content_moderation_notifications/src/ContentModerationNotificationsAccessController.php
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------
24 | WARNING | Possible useless method overriding detected
------------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/content_moderation_notifications/src/Form/ContentModerationNotificationsFormBase.php
---------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------
150 | ERROR | [x] Use null coalesce operator instead of ternary operator.
---------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/content_moderation_notifications/src/Notification.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------------------------------
129 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
141 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
159 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
184 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
206 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/content_moderation_notifications/tests/src/Functional/Form/CrudFormTest.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 16 WARNINGS AFFECTING 16 LINES
------------------------------------------------------------------------------------------------------------------------------------------
73 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
86 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
91 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
124 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
126 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
141 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
148 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
152 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
159 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
163 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
164 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
165 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
178 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
180 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
181 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
182 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/content_moderation_notifications/tests/src/Kernel/TokenNotificationsTest.php
-------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------
110 | WARNING | Unused variable $notification.
-------------------------------------------------------------------------------------------------------
Time: 1.5 secs; Memory: 12MB
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/content_moderation_notifications/
Proposed resolution
Above error/warnings need to be fixed
Note:
I have removed following line of code as it only called it's parent checkAccess
function nothing else from src/ContentModerationNotificationsAccessController.php file. We can add this later if there is any specific code for the same.
/**
* {@inheritdoc}
*/
public function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
// No special access handling. Defer to the entity system which will only
// allow admin access by default.
return parent::checkAccess($entity, $operation, $account);
}