Problem/Motivation
Coding standards issue found by phpcs.
FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/multi_region/src/Form/ConfigurableRegionForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
10 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
41 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
68 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------
FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/multi_region/src/Plugin/Block/RegionLanguageSwitcherBlock.php
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Access\AccessResult.
--------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------
FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/multi_region/src/ConfigurableRegionHtmlRouteProvider.php
---------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------
19 | WARNING | Possible useless method overriding detected
---------------------------------------------------------------------------------------------------------------------------------
FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/multi_region/src/ConfigurableRegionAccessControlHandler.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Access\AccessResult.
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------
FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/multi_region/src/ConfigurableRegionListBuilder.php
---------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------
7 | WARNING | [x] Unused use statement
---------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------
FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/multi_region/src/RegionManager.php
-----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
-----------------------------------------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
8 | WARNING | [x] Unused use statement
129 | ERROR | [x] Object operator not indented correctly; expected 8 spaces but found 10
139 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------
Steps to reproduce
Use the below command with arguments:-
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml web/modules/custom/multi_region
Proposed resolution
Fix the phpcs issue found.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | Screenshot (86).png | 49.55 KB | satish_kumar |
| #4 | Screenshot (84).png | 50.83 KB | satish_kumar |
| #3 | interdiff_2-3.txt | 598 bytes | mrinalini9 |
| #3 | phpcs-issue-found-3369992-3.patch | 6.64 KB | mrinalini9 |
| #2 | phpcs-issue-found-3369992-2.patch | 5.88 KB | ashutosh ahirwal |
Comments
Comment #2
ashutosh ahirwal commentedProviding patch with some fixes one error remaining need to fix.
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml web/modules/custom/multi_region
FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/multi_region/src/ConfigurableRegionHtmlRouteProvider.php
---------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------
19 | WARNING | Possible useless method overriding detected
---------------------------------------------------------------------------------------------------------------------------------
Time: 303ms; Memory: 12MB
Comment #3
mrinalini9 commentedUpdated patch #2 by addressing the warning as mentioned in #2, please review it.
Thanks & Regards,
Mrinalini
Comment #4
satish_kumar commentedHi @mrinalini9 7, I have applied your patch and run successfully .
These are the steps I followed:
1. Took clone from git version 1.0 in drupal 10.1.x
2. Ran this command:
3. Applied patch and again ran phpcs command.
found no errors.
Moving to RTBC.
Comment #6
isaacrc commentedFixed and merged into the 2.0.0 release. Thanks, everyone!
Comment #8
isaacrc commented