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

Issue fork visitors-3397326

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bluegeek9 created an issue. See original summary.

bluegeek9’s picture

Assigned: bluegeek9 » Unassigned

viren18febS made their first commit to this issue’s fork.

SandeepSingh199 made their first commit to this issue’s fork.

  • bluegeek9 committed 4314f6b0 on 8.x-2.x
    Issue #3397326 by bluegeek9, SandeepSingh199: Issues reported by PHPStan
    
bluegeek9’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

bluegeek9’s picture

This issue was resolved. A new release, 8.x-2.17, will be made soon, May 31st.

This is an excellent opportunity to beta test the dev branch, and report any issues.

Contributors (5)

bluegeek9, roshni27, abhishek_gupta1, sarwan_verma, SandeepSingh199

Changelog

Issues: 32 issues resolved.

Changes since 8.x-2.16:

Bug

Feature

Task