To replicate goto module directory and run
phpcs --standard=DrupalPractice .
Output
FILE: ..../domain_301_redirect/src/Form/Domain301RedirectConfigForm.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
40 | WARNING | t() calls should be avoided in classes, use
| | dependency injection and $this->t() instead
88 | WARNING | Unused variable $config.
----------------------------------------------------------------------
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | interdiff-2954889-14.txt | 2.61 KB | sheshsharma |
| #14 | 2954889-14.patch | 2.55 KB | sheshsharma |
Issue fork domain_301_redirect-2954889
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 #2
surbz commentedComment #3
surbz commentedHere is the patch to fix this
Comment #4
surbz commentedComment #5
msankhala commentedI can confirm that patch #3 applies cleanly on 8.x-1.x branch and it fixes this coding standard issue.
Comment #6
th_tushar commentedI also face below issues, when coder is executed on a module,
Comment #7
msankhala commented@th_tushar Have you run coder after applying the provided patch? Looks like you are using Window system and your editor is not configured correctly and that editor converted line ending character from "\n" to "\r\n" which is default line ending characters for Window OR you hit the Ctrl+s on the files you reported the issue and your editor replaced the line ending character from "\n" to "\r\n".
Patch applies cleanly. This is still RTBC.
Comment #8
msankhala commentedComment #9
th_tushar commentedFYI, I haven't opened any of the module files in my editor. Just cloned the module and ran coder on the module, and this errors.
Comment #10
msankhala commentedIn this case, the patch is much appreciated.
Comment #11
msankhala commented@th_tushar I run the PHP code sniffer on fresh clone but I don't see any such error or warnings.
No output on last command.
Comment #12
msankhala commentedComment #13
naveenvalechaRetitling the issue to cover the removal of deprecated code as well as part of same issue.
Comment #14
sheshsharma commentedAdding patch to make the module D9 compatible.
Tested it on D8.9.0 as well as D9, installs successfully after applying the attached patch.
Comment #15
devdesagar commentedHi Team,
Patch#14 is working fine for me
Comment #16
devdesagar commentedComment #19
pookmish commented