Issues reported by PHPStan

Created on 27 October 2023, about 1 year ago
Updated 22 May 2024, 7 months ago

Problem/Motivation

PHPStan was added to the default CI pipeline.

Some of the issues overlap with drupal-check.

Steps to reproduce

$ php vendor/bin/phpstan analyze $_WEB_ROOT/modules/custom/$CI_PROJECT_NAME $PHPSTAN_CONFIGURATION --no-progress || EXIT_CODE=$?
 ------ ------------------------------------------------------------------------------ 
  Line   src/Controller/Report/DaysOfMonth.php                                         
 ------ ------------------------------------------------------------------------------ 
  48     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Controller/Report/DaysOfWeek.php                                          
 ------ ------------------------------------------------------------------------------ 
  48     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Controller/Report/HitDetails.php                                          
 ------ ------------------------------------------------------------------------------ 
  32     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Controller/Report/HostController.php                                      
 ------ ------------------------------------------------------------------------------ 
  32     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Controller/Report/Hours.php                                               
 ------ ------------------------------------------------------------------------------ 
  48     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Controller/Report/MonthlyHistory.php                                      
 ------ ------------------------------------------------------------------------------ 
  48     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Controller/Report/Node.php                                                
 ------ ------------------------------------------------------------------------------ 
  51     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Controller/Report/RecentHits.php                                          
 ------ ------------------------------------------------------------------------------ 
  32     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Controller/Report/Referer.php                                             
 ------ ------------------------------------------------------------------------------ 
  41     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Controller/Report/RouteController.php                                     
 ------ ------------------------------------------------------------------------------ 
  32     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Controller/Report/TopPageController.php                                   
 ------ ------------------------------------------------------------------------------ 
  33     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Controller/Report/UserActivity.php                                        
 ------ ------------------------------------------------------------------------------ 
  43     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Controller/Visitors.php                                                   
 ------ ------------------------------------------------------------------------------ 
  35     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Form/RebuildDeviceForm.php                                                
 ------ ------------------------------------------------------------------------------ 
  37     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Form/RebuildIpAddressForm.php                                             
 ------ ------------------------------------------------------------------------------ 
  36     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Form/RebuildRouteForm.php                                                 
 ------ ------------------------------------------------------------------------------ 
  37     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Plugin/Block/VisitorsBlock.php                                            
 ------ ------------------------------------------------------------------------------ 
  116    Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Plugin/Block/VisitorsPopularBlock.php                                     
 ------ ------------------------------------------------------------------------------ 
  84     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ---------------------------------------------------------------------- 
  Line   src/Plugin/views/area/VisitorsDisplayLink.php                         
 ------ ---------------------------------------------------------------------- 
  84     \Drupal calls should be avoided in classes, use dependency injection  
         instead                                                               
 ------ ---------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   src/Plugin/views/field/VisitorsBrowserVersion.php                     
 ------ ---------------------------------------------------------------------- 
  24     \Drupal calls should be avoided in classes, use dependency injection  
         instead                                                               
 ------ ---------------------------------------------------------------------- 
 ------ ----------------------------------------------------------- 
 ------ ------------------------------------------------------------------------------ 
  Line   visitors_geoip/src/Controller/Cities.php                                      
 ------ ------------------------------------------------------------------------------ 
  41     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   visitors_geoip/src/Controller/CityHits.php                                    
 ------ ------------------------------------------------------------------------------ 
  41     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   visitors_geoip/src/Controller/Countries.php                                   
 ------ ------------------------------------------------------------------------------ 
  41     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   visitors_geoip/src/Form/RebuildLocationForm.php                               
 ------ ------------------------------------------------------------------------------ 
  37     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   visitors_geoip/src/Form/SettingsForm.php                                      
 ------ ------------------------------------------------------------------------------ 
  27     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ --------------------------------------------------------- 
  Line   visitors_geoip/tests/src/Unit/Form/SettingsFormTest.php  
 ------ --------------------------------------------------------- 
  64     Call to deprecated method withConsecutive() of class     
         PHPUnit\Framework\MockObject\Builder\InvocationMocker.   
 ------ --------------------------------------------------------- 

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇺🇸United States bluegeek9

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