Problem/Motivation
Running phpcs and phpstan against the module reveals several issues:
PHPCS
FILE: /var/www/html/debug/web/modules/contrib/remove_reset_password/src/EventSubscriber/PasswordSubscriber.php
--------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------------------------------------
6 | WARNING | [x] Unused use statement
12 | ERROR | [x] Missing class doc comment
14 | ERROR | [ ] Missing member variable doc comment
20 | ERROR | [x] Missing function doc comment
26 | ERROR | [x] Missing function doc comment
36 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/debug/web/modules/contrib/remove_reset_password/remove_reset_password.services.yml
------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------
PHPSTAN
------ ------------------------------------------------------------------------------
Line src/EventSubscriber/PasswordSubscriber.php
------ ------------------------------------------------------------------------------
36 \Drupal calls should be avoided in classes, use dependency injection instead
🪪 globalDrupalDependencyInjection.useDependencyInjection
------ ------------------------------------------------------------------------------
Steps to reproduce
1. vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml web/modules/contrib/remove_reset_password
2. vendor/bin/phpstan analyse web/modules/contrib/remove_reset_password
Issue fork remove_reset_password-3600879
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 #3
dkmishra commentedComment #4
yusuf_khan commented@MAINTAINER review has been done , please the output below no phpcs and phpstann issue
ykhan@COMM--YKHAN-MAC my-drupal-site $ vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml web/modules/custom/remove_reset_password-3600879
ykhan@COMM--YKHAN-MAC my-drupal-site $ vendor/bin/phpstan analyse web/modules/custom/remove_reset_password-3600879
3/3 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
[OK] No errors
💡 Tip of the Day:
PHPStan is performing only the most basic checks.
You can pass a higher rule level through the --level option
(the default and current level is 0) to analyse code more thoroughly.
ykhan@COMM--YKHAN-MAC my-drupal-site $
Comment #5
vinodhini.e commentedHi, Verified the reported PHPCS and PHPStan issues on Drupal 11.3.11 by running the commands provided in the issue summary.
The same coding standard violations and dependency injection warning were reported in PasswordSubscriber.php, along with the YAML formatting issue in remove_reset_password.services.yml.
Applied MR !6 and reran both PHPCS and PHPStan checks. No issues were reported after applying the patch.
Thanks.
Comment #6
dkmishra commented