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.

Comments

Ashutosh Ahirwal created an issue. See original summary.

ashutosh ahirwal’s picture

Assigned: ashutosh ahirwal » Unassigned
Status: Active » Needs work
StatusFileSize
new5.88 KB

Providing 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

mrinalini9’s picture

Status: Needs work » Needs review
StatusFileSize
new6.64 KB
new598 bytes

Updated patch #2 by addressing the warning as mentioned in #2, please review it.

Thanks & Regards,
Mrinalini

satish_kumar’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new50.83 KB
new49.55 KB

Hi @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:

./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig modules/contrib/multi_region/

before_review

3. Applied patch and again ran phpcs command.

after_review

found no errors.

Moving to RTBC.

  • isaacrc committed 51d858fa on 2.0.x
    Issue #3369992: Fix the issues reported by phpcs
    
    - Sort use statements...
isaacrc’s picture

Status: Reviewed & tested by the community » Fixed

Fixed and merged into the 2.0.0 release. Thanks, everyone!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

isaacrc’s picture

Status: Fixed » Closed (fixed)