Found some coding standard issues.

FILE: /var/www/drupalvm/drupal/web/modules/contrib/autologout/tests/src/Functional/AutologoutTest.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 14 WARNINGS AFFECTING 14 LINES
------------------------------------------------------------------------------------------------------------------------------------------
 209 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 263 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 266 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 283 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 286 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 303 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 306 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 324 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 327 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 329 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 330 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 339 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 367 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 443 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/drupalvm/drupal/web/modules/contrib/autologout/src/AutologoutManager.php
-------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------
 248 | WARNING | User::load calls should be avoided in classes, use dependency injection instead
 295 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 298 | WARNING | User::load calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------


FILE: /var/www/drupalvm/drupal/web/modules/contrib/autologout/src/EventSubscriber/AutologoutSubscriber.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------
 88 | ERROR | The $_GET super global must not be accessed directly; inject the request.stack service and use
    |       | $stack->getCurrentRequest()->query->get('autologout_timeout') instead
 88 | ERROR | The $_GET super global must not be accessed directly; inject the request.stack service and use
    |       | $stack->getCurrentRequest()->query->get('autologout_timeout') instead
 88 | ERROR | The $_POST super global must not be accessed directly; inject the request.stack service and use $stack->getCurrentRequest()->request
    |       | instead
------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/drupalvm/drupal/web/modules/contrib/autologout/src/Controller/AutologoutController.php
-----------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------
 110 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------

Comments

kbrodej created an issue. See original summary.

kbrodej’s picture

Status: Active » Needs review
StatusFileSize
new11.73 KB

Attaching patch to solve these CS issues.

kbrodej’s picture

Title: Drupal Coding Standarad issues » Drupal Coding Standard issues
Pooja Ganjage’s picture

Hii,

While running module in local environment one error occurs that is
Declaration of Drupal\autologout\AutologoutManager::logoutRole($user) must be compatible with Drupal\autologout\AutologoutManagerInterface::logoutRole(Drupal\user\Entity\User $user)

So, solution for this need to provide User class argument into Drupal\autologout\AutologoutManager::logoutRole(User $user) in such way.

Thanks.

Pooja Ganjage’s picture

StatusFileSize
new144.93 KB

Hii,

I am applying patch for whole coding standards and solution of what I faced issue in my previous comment #4.

Please review once and let me know.

Thanks.

Pooja Ganjage’s picture

ajits’s picture

Status: Needs review » Needs work
Issue tags: +DIACWAug2020, +Needs reroll

The patch is not applicable and needs reroll.

shetpooja04’s picture

Status: Needs work » Needs review
StatusFileSize
new144.07 KB

Rerolled the patch #5

Status: Needs review » Needs work

The last submitted patch, 8: 3156418-8.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

ajits’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new11.73 KB

Apologies for not mentioning this before, but it seems like the scope of the issue was changed in comment #5 which tries to address the issue mentioned in comment #4.

This issue should be used to address the coding standard issues. For the other issue mentioned in #4 we are tracking that under #3121214: AutologoutManager class incompatible with interface and should be followed up there.

Re-uploading the patch from #2.

deaom’s picture

Status: Needs review » Reviewed & tested by the community

Hi, phpcs does not return any errors/warnings after the patch is applies, so marking this as RTBC.

phthlaap’s picture

Please help to commit patch to resolve this issue. I get this issue when I run PHPUnit for other feature in my local site.

Fatal error: Declaration of Drupal\autologout\AutologoutManager::logoutRole($user) must be compatible with Drupal\autologout\AutologoutManagerInterface::logoutRole(Drupal\user\Entity\User $user) in /Users/leopham/Working/Projects/htcc-backend/web/modules/contrib/autologout/src/AutologoutManager.php on line 21PHP Fatal error:  Declaration of Drupal\autologout\AutologoutManager::logoutRole($user) must be compatible with Drupal\autologout\AutologoutManagerInterface::logoutRole(Drupal\user\Entity\User $user) in /Users/leopham/Working/Projects/htcc-backend/web/modules/contrib/autologout/src/AutologoutManager.php on line 21
Pooja Ganjage’s picture

StatusFileSize
new853 bytes

Hi,

I am applying patch for resolving issue as mentioned in #12 comment.

Review the patch once.

Thanks.

  • boshtian committed bfb19b7 on 8.x-1.x authored by kbrodej
    Issue #3156418 by kbrodej, AjitS, DeaOm: Drupal Coding Standard issues
    
boshtian’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.