Closed (fixed)
Project:
Force Password Change
Version:
2.0.x-dev
Component:
Code
Priority:
Minor
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
12 Mar 2024 at 10:59 UTC
Updated:
5 Dec 2025 at 15:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
chaitanyadessai commentedPlease review.
Comment #3
avpadernoComment #4
avpadernoComment #6
cleavinjosh commentedHi @apaderno,
I applied MR!14, it was applied smoothly and fixed all the t() calls issues.
However, when I run
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml, I encountered some issues.Thank you.
Comment #7
avpadernoThis issue is for avoiding to use
t()in classes, where possible, not to fix all the warnings/errors reported by PHP_CodeSniffer.Comment #8
heddnThanks #7 for your input. I typically would agree with you. But since this and #3426541: \Drupal calls should be avoided in classes, use dependency injection instead are dealing with 2 different phpcs things I wonder if we should just re-title/re-purpose to fix all phpcs issues in one shot. Instead of having to review several distinct issues. With that mind, re-titling and closing the other as duplicate to this.
NW to address all PHPCS.
Comment #10
sdhruvi5142 commentedIdentifying and fixing all the phpcs issues.
Comment #12
sdhruvi5142 commentedFixed all the PHPcs issues as per the comment #8 in this issue only
Created and MR for the issues Fixed.
Moving this to Needs review for quick checkes.
can be moved to RTBC.
Comment #13
heddnNeeds a rebase
Comment #15
jerech commentedRefactored multiple classes to eliminate direct \Drupal service calls, replacing them with proper dependency injection. Updated constructors and .services.yml definitions where needed. This includes forms, event subscribers, mappers, and the role list builder. As a result, all PHPCS violations related to service usage have been resolved. PHPUnit tests were re-run and confirmed to pass after the changes.
Comment #17
schillerm commentedHi, I just ran phpcs on !MR18 and got this back ..
phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml web/modules/contrib/force_password_change
FILE: ...topuser/Documents/Issues/Dev-11-3427315/web/modules/contrib/force_password_change/tests/src/Kernel/ForcePasswordChangeTest.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
14 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\KernelTests\KernelTestBase.
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------
FILE: .../laptopuser/Documents/Issues/Dev-11-3427315/web/modules/contrib/force_password_change/src/Mapper/ForcePasswordChangeMapper.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Datetime\TimeInterface.
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------
FILE: ...Dev-11-3427315/web/modules/contrib/force_password_change/src/EventSubscriber/ForcePasswordChangeConfigPostUpdateSubscriber.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigCrudEvent.
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------
FILE: ...ocuments/Issues/Dev-11-3427315/web/modules/contrib/force_password_change/src/Service/ForcePasswordChangeRedirectMiddleware.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
| | Symfony\Component\HttpFoundation\RedirectResponse.
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------
FILE: ...aptopuser/Documents/Issues/Dev-11-3427315/web/modules/contrib/force_password_change/src/Service/ForcePasswordChangeService.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\user\Entity\User.
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------
FILE: /home/laptopuser/Documents/Issues/Dev-11-3427315/web/modules/contrib/force_password_change/README.md
----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 7 WARNINGS AFFECTING 7 LINES
----------------------------------------------------------------------------------------------------------
3 | WARNING | Line exceeds 80 characters; contains 108 characters
4 | WARNING | Line exceeds 80 characters; contains 102 characters
9 | WARNING | Line exceeds 80 characters; contains 106 characters
10 | WARNING | Line exceeds 80 characters; contains 112 characters
12 | WARNING | Line exceeds 80 characters; contains 108 characters
14 | WARNING | Line exceeds 80 characters; contains 111 characters
15 | WARNING | Line exceeds 80 characters; contains 107 characters
----------------------------------------------------------------------------------------------------------
Time: 271ms; Memory: 14MB
So I fixed these errors and pushed up a commit with my changes.
Comment #18
heddnLeft some feedback on the MR.
Comment #19
schillerm commentedHi, I have pushed up changes which should hopefully fix this (#18). This is the first time I have worked on .gitlab-ci.yml so please check this. I have gitlab-ci-local set up locally to try to run gitlab-ci but it this case it was not able to run.
Comment #20
heddnFeedback posted on MR.
Comment #21
jerech commentedComment #22
schillerm commentedHi, I was getting these three unknown words when running cspell.
Unknown word (uids)
Unknown word (tabledrag)
Unknown word (prophesize)
so added reviewed them and then added them to the list.
Comment #23
heddnThat last change needs to revert I think. See MR comments.
Comment #24
schillerm commentedapologies , will revert that last commit and push it up.
Comment #25
heddnComment #28
heddn