Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml ./ returns the following warnings/errors, which need to be fixed, if they are not false positives.
FILE: ./realname/realname.module
-------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------
18 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Render\BubbleableMetadata.
224 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------
FILE: ./realname/src/Controller/RealnameAutocompleteController.php
-------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Utility\Crypt.
24 | ERROR | [ ] The array declaration extends to column 92 (the limit is 80). The array content should be split up over multiple
| | lines
73 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------
FILE: ./realname/src/Plugin/migrate/process/RealnameReplaceToken.php
-------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\migrate\MigrateExecutableInterface.
23 | ERROR | [x] list(...) is forbidden, use [...] instead.
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------
Time: 110ms; Memory: 10MB
I left out the warnings/errors that are going to be fixed in #3359562: t() should not be used in test classes
Comments
Comment #2
omkar_yewale commentedComment #4
omkar_yewale commented!12 MR created, Please Review.
Comment #5
akram khanchecked above MR it fixed the PHPCS issue
Comment #6
avpadernoTWIG is misspelled.
Instead of fixing that comment, it should be better to remove it, as it just describes what is already clear from the code.
The Drupal coding standards say that control structures are written in a single line.
That code is formatted as per PSR12 coding standards, not the coding standards followed by Drupal.
Comment #7
sumit-k commentedThanks for reviewing, recently mentioned issues are fixed in the following patch
https://www.drupal.org/files/issues/2023-07-07/t_calls_should_be_avoided-3359562-11.patch. Thread - https://www.drupal.org/project/realname/issues/3359562#comment-15140770IMO attaching the same patch to this thread would be redundant since it is already available in the mentioned thread.
Comment #8
avpadernoIt is the other issue that is doing off-topic changes. If I open an issue to avoid calls to
t()in classes, I cannot then fix all the coding standards issues reported by a tool, or I would change the topic of the issue.Comment #9
avpadernoI also not get any error about invalid end-of-line characters, when I run PHP_CodeSniffer.
Comment #11
keshavv commentedI have scanned the module with the command
and fixed all pending issues.
Now we can review and merge it.
Thank you.
Comment #12
roberttabigue commentedHi,
I applied the latest MR !12 to the Real Name module against 2.x-dev on Drupal 9.5.10 and confirmed all PHPCS errors have been fixed.
I ran this command on the module:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml realname/Please see the attached files for reference.
I'm moving this now to RTBC.
Thank you!
Comment #13
avpadernoComment #14
nitin_lamaComment #15
nitin_lamaComment #16
avpadernoComment #17
nitin_lamaComment #18
nitin_lamaComment #19
yashaswi18 commentedHello, I cloned the repository, checked out to the branch '3352347-fix-the-issues', ran the command phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml. Found one error remaining:
Comment #20
nitinkumar_7 commentedHi, @Yashaswi18, can you please provide steps to reproduce these errors you found?
I have also applied the latest MR !12 and checked out to the branch '3352347-fix-the-issues'.
I scanned the module with the command:
vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/realnameand confirmed all PHPCS errors have been fixed.
Thank you
Comment #21
nitinkumar_7 commentedApplied the latest MR !12 and checked out to the branch '3352347-fix-the-issues'.
I have scanned module with this command :
vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/realnameall PHPCS errors have been fixed.

screenshot is attached for reference
Moving this to RTBC
Comment #22
nitinkumar_7 commented