Problem/Motivation
There are issues reported by phpcs for this module.
FILE: src/FormAlter.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------
231 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
248 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------
Time: 305ms; Memory: 12MB
Steps to reproduce
Run phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,yml .
Proposed resolution
Provide patch file that addresses these issues
Comments
Comment #2
davidburnsComment #3
davidburnsFixed a couple of other PHPCS things that popped up after applying that patch.
Here's the updated version that has everything passing.
Comment #4
avpadernoThe issue summary should always describe what the issue is trying to fix and, in the case, of coding standards issues, report which command has been used, which arguments have been used, and which report that command shown.
(The patches fail to apply too.)
Comment #6
hardikpandya commentedComment #8
hardikpandya commentedComment #9
rajneeshb commentedReviewed MR 2, Looks good, +1RTBC
Attaching screenshots for the reference.
Comment #10
avpadernoComment #11
liam morlandThis will need a re-roll because of #3347720: Use constructor property promotion. Please use constructor property promotion for the new properties.
Comment #12
nikhil_110 commentedi try to resolve this issue
Comment #13
avpadernoComment #14
nikhil_110 commentedComment #15
liam morlandComment #16
priyanka_chauhan31 commentedHi, Working on this issue.
Comment #17
priyanka_chauhan31 commentedHi, I tried to solve the issue. Here is the patch attached for the same.
Comment #18
liam morlandOn PHP 8.2, I expect there will be deprecation notices because of the use of dynamic properties.
$this->destinationand$this->rendererneed to be declared. This can be done like it is for$entityTypeManagerby adding a keyword likeprotectedin the constructor.Comment #19
priyanka_chauhan31 commentedHi, I have added protected keyword in constructor as said. Please review my new patch.
Comment #20
liam morlandThanks @priyanka_chauhan31. After adding
protected, you don't need to assign the values; that happens automatically. Please test the merge request.Comment #21
liam morlandMR as a patch.
Comment #22
liam morlandMR as a patch.
Comment #23
liam morlandComment #24
liam morlandComment #27
liam morland