Fix PHPCS and PHPStan

Created on 6 November 2023, about 1 year ago
Updated 19 June 2024, 5 months ago

Problem/Motivation

FILE: web/modules/custom/theme_permission/src/ThemePerm.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 8 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\Core\Extension\ThemeHandlerInterface.
   |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...ules/custom/theme_permission/src/Controller/AccessController.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
  8 | ERROR | [x] Use statements should be sorted alphabetically. The
    |       |     first wrong one is
    |       |     Drupal\Core\Access\AccessResult.
    |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
 44 | ERROR | [ ] Parameter $module_extension_list is not described
    |       |     in comment
    |       |     (Drupal.Commenting.FunctionComment.ParamMissingDefinition)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Time: 234ms; Memory: 4MB
PHP CODE SNIFFER REPORT SUMMARY
----------------------------------------------------------------------
FILE                                                  ERRORS  WARNINGS
----------------------------------------------------------------------
...modules/custom/theme_permission/src/ThemePerm.php  1       0
...me_permission/src/Controller/AccessController.php  2       0
----------------------------------------------------------------------
A TOTAL OF 3 ERRORS AND 0 WARNINGS WERE FOUND IN 10 FILES
----------------------------------------------------------------------
PHPCBF CAN FIX 2 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
----------------------------------------------------------------------
    SOURCE                                                       COUNT
----------------------------------------------------------------------
[x] SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.  2
[ ] Drupal.Commenting.FunctionComment.ParamMissingDefinition     1
----------------------------------------------------------------------
A TOTAL OF 3 SNIFF VIOLATIONS WERE FOUND IN 2 SOURCES
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SOURCES AUTOMATICALLY (2 VIOLATIONS IN TOTAL)
----------------------------------------------------------------------
 ------ ---------------------------------------------------------------- 
  Line   src/Controller/AccessController.php                             
 ------ ---------------------------------------------------------------- 
  318    Offset 'uninstalled' on array{installed: array{}, uninstalled:  
         array{}} in empty() always exists and is always falsy.          
 ------ ---------------------------------------------------------------- 
 ------ --------------------------------------------------------------------------------------------------- 
  Line   tests/src/Functional/AccessBlockBrowserTest.php                                                    
 ------ --------------------------------------------------------------------------------------------------- 
  17     Method                                                                                             
         Drupal\Tests\theme_permission\Functional\AccessBlockBrowserTest::testIfAccessThemeStable9()        
         has no return type specified.                                                                      
  26     Method                                                                                             
         Drupal\Tests\theme_permission\Functional\AccessBlockBrowserTest::testIfAccessDeniedThemeStable9()  
         has no return type specified.                                                                      
  35     Method                                                                                             
         Drupal\Tests\theme_permission\Functional\AccessBlockBrowserTest::testIfShowOlivero()               
         has no return type specified.                                                                      
  49     Method                                                                                             
         Drupal\Tests\theme_permission\Functional\AccessBlockBrowserTest::testIfNotShowOlivero()            
         has no return type specified.                                                                      
 ------ --------------------------------------------------------------------------------------------------- 
 ------ --------------------------------------------------------------------------------------------------- 
  Line   tests/src/Functional/AccessThemeBrowserTest.php                                                    
 ------ --------------------------------------------------------------------------------------------------- 
  19     Method                                                                                             
         Drupal\Tests\theme_permission\Functional\AccessThemeBrowserTest::testIfAccessThemeStable9()        
         has no return type specified.                                                                      
  28     Method                                                                                             
         Drupal\Tests\theme_permission\Functional\AccessThemeBrowserTest::testIfAccessDeniedThemeStable9()  
         has no return type specified.                                                                      
  37     Method                                                                                             
         Drupal\Tests\theme_permission\Functional\AccessThemeBrowserTest::testEditAdminTheme()              
         has no return type specified.                                                                      
  46     Method                                                                                             
         Drupal\Tests\theme_permission\Functional\AccessThemeBrowserTest::testNotEditAdminTheme()           
         has no return type specified.                                                                      
  55     Method                                                                                             
         Drupal\Tests\theme_permission\Functional\AccessThemeBrowserTest::testIfPermissionsIsPresent()      
         has no return type specified.                                                                      
 ------ --------------------------------------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------------- 
  Line   tests/src/Functional/ThemePermissionTestBase.php                               
 ------ ------------------------------------------------------------------------------- 
  24     PHPDoc type array of property                                                  
         Drupal\Tests\theme_permission\Functional\ThemePermissionTestBase::$modules     
         is not covariant with PHPDoc type array<string> of overridden                  
         property Drupal\Tests\BrowserTestBase::$modules.                               
         ๐Ÿ’ก You can fix 3rd party PHPDoc types with stub files:                         
         ๐Ÿ’ก https://phpstan.org/user-guide/stub-files                                   
                                                                                        
  59     Method                                                                         
         Drupal\Tests\theme_permission\Functional\ThemePermissionTestBase::userLogin()  
         has no return type specified.                                                  
  71     Parameter #1 $account of method                                                
         Drupal\Tests\BrowserTestBase::drupalLogin() expects                            
         Drupal\Core\Session\AccountInterface, Drupal\user\Entity\User|false            
         given.                                                                         
 ------ ------------------------------------------------------------------------------- 
 [ERROR] Found 13 errors 
๐Ÿ“Œ Task
Status

Active

Version

2.0

Component

Code

Created by

๐Ÿ‡ซ๐Ÿ‡ทFrance liber_t Lille

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024