Problem/Motivation

FILE: /var/www/html/web/modules/custom/menu_item_role_access/menu_item_role_access.module
-----------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------
 24 | WARNING | Unused variable $config.
-----------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/menu_item_role_access/src/Form/ConfigForm.php
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
 10 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
-----------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/menu_item_role_access/src/MenuItemRoleAccessLinkTreeManipulator.php
-----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------
 79 | WARNING | MenuLinkContent::load calls should be avoided in classes, use dependency injection instead
 91 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------------

Comments

Ashutosh Ahirwal created an issue. See original summary.

ashutosh ahirwal’s picture

Assigned: ashutosh ahirwal » Unassigned
Status: Needs work » Needs review
StatusFileSize
new604 bytes

Providing patch.
Need review.

ashutosh ahirwal’s picture

Issue tags: +phpcs
arunkumark’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: -
StatusFileSize
new206.28 KB
new136.35 KB

I tested the patch working as expected to remove the unused variable $config.

Before applying patch:

Before

After applying patch:

After

But there are a few other warnings. It would be great we are resolving all the warning errors.

Warnings are,

FILE: /var/www/html/web/modules/custom/menu_item_role_access/src/Form/ConfigForm.php
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
 10 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
-----------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/menu_item_role_access/src/MenuItemRoleAccessLinkTreeManipulator.php
-----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------
 79 | WARNING | MenuLinkContent::load calls should be avoided in classes, use dependency injection instead
 91 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------------
arunkumark’s picture

mukesh88’s picture

StatusFileSize
new3.98 KB
new3.22 KB

Fixes PHPCS issues and created patch

hardikpandya’s picture

Status: Needs work » Closed (duplicate)

This would be covered as part of https://www.drupal.org/project/menu_item_role_access/issues/3293109 where more work for fixing all phpcs issues is being done. Closing this!