Fix phpstan issues

Created on 2 November 2023, about 1 year ago

Problem/Motivation

When running automated tests. We get the next phpstan issues:

------------------------------------------------------------------------------ 
  Line   src/Controller/AutologoutController.php                                       
 ------ ------------------------------------------------------------------------------ 
  63     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Form/AutologoutBlockForm.php                                              
 ------ ------------------------------------------------------------------------------ 
  43     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Form/AutologoutSettingsForm.php                                           
 ------ ------------------------------------------------------------------------------ 
  67     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Plugin/Block/AutologoutWarningBlock.php                                   
 ------ ------------------------------------------------------------------------------ 
  107    Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ---------------------------------------------------------------------- 
  Line   src/Plugin/migrate/destination/ConfigAutologoutRoles.php              
 ------ ---------------------------------------------------------------------- 
  22     \Drupal calls should be avoided in classes, use dependency injection  
         instead                                                               
 ------ ---------------------------------------------------------------------- 
 ------ --------------------------------------------------------------------- 
  Line   tests/src/Kernel/Migrate/d6/MigrateAutologoutSettingsTest.php        
 ------ --------------------------------------------------------------------- 
  47     You should use assertFalse() instead of assertSame() when expecting  
         "false"                                                              
  49     You should use assertFalse() instead of assertSame() when expecting  
         "false"                                                              
  52     You should use assertFalse() instead of assertSame() when expecting  
         "false"                                                              
  53     You should use assertFalse() instead of assertSame() when expecting  
         "false"                                                              
 ------ --------------------------------------------------------------------- 
 ------ --------------------------------------------------------------------- 
  Line   tests/src/Kernel/Migrate/d7/MigrateAutologoutSettingsTest.php        
 ------ --------------------------------------------------------------------- 
  44     You should use assertFalse() instead of assertSame() when expecting  
         "false"                                                              
  46     You should use assertFalse() instead of assertSame() when expecting  
         "false"                                                              
  49     You should use assertFalse() instead of assertSame() when expecting  
         "false"                                                              
  50     You should use assertFalse() instead of assertSame() when expecting  
         "false"                                                              
  51     You should use assertFalse() instead of assertSame() when expecting  
         "false"                                                              
 ------ --------------------------------------------------------------------- 

Remaining tasks

  1. Create phpstan.neon.dist file similar to core, Ignoring that part correctly, now it's also complaining about usage of \Drupal in tests.
📌 Task
Status

Needs work

Version

1.0

Component

Code

Created by

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

Comments & Activities

Production build 0.71.5 2024