Drupal 9 Compatibility (cumulative patch set)
requested to merge issue/content_notify-3146896:3146896-8-drupal-9-compatibility-reroll into 8.x-2.x
This Merge Request should only contain the git commit with SHA 9cf7bfc0.
It incorporates all the Drupal 9 compatibility fixes from comment #4: https://www.drupal.org/project/content_notify/issues/3146896#comment-13831325
It also improves code standards and practice by adding type hinting for Node objects, following the docblock standards for parameters, and other fixes suggested by PHPCS.
For the record, there are a few warnings I'm not fixing at this time:
FILE: /opt/nas/repos/drupal/contrib/content_notify-3146896/src/Form/NotifyConfigForm.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------
285 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
-----------------------------------------------------------------------------------------------------------------------
FILE: /opt/nas/repos/drupal/contrib/content_notify-3146896/src/Form/NotifyExtendForm.php
----------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------------------------
68 | ERROR | Parameter $form is not described in comment
68 | ERROR | Parameter $form_state is not described in comment
99 | WARNING | Do not pass empty strings to t()
176 | WARNING | Only string literals should be passed to t() where possible
----------------------------------------------------------------------------------------
FILE: /opt/nas/repos/drupal/contrib/content_notify-3146896/src/ContentNotifyManager.php
---------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
---------------------------------------------------------------------------------------
353 | ERROR | String concat is not required here; use a single string instead
354 | ERROR | String concat is not required here; use a single string instead
360 | ERROR | String concat is not required here; use a single string instead
---------------------------------------------------------------------------------------
FILE: /opt/nas/repos/drupal/contrib/content_notify-3146896/content_notify.module
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
436 | WARNING | Unused variable $unpublish_on_unixtime.
437 | WARNING | Unused variable $notify_invalid_on_unixtime.
--------------------------------------------------------------------------------
FILE: /opt/nas/repos/drupal/contrib/content_notify-3146896/src/Form/NotifyConfigForm.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------
317 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------
FILE: /opt/nas/repos/drupal/contrib/content_notify-3146896/src/Form/NotifyExtendForm.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------
76 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
142 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
154 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
156 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------
FILE: /opt/nas/repos/drupal/contrib/content_notify-3146896/src/ContentNotifyManager.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------
281 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
349 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------
These style fixes are not necessary to achieve minimal Drupal 9 compatibility, but they may cause the MR to fail automated testing so they should be addressed before merging.
Closes #3146896