Fix PHPStan violations (happened because PHPStan code checks stopped running…)

Created on 15 February 2023, over 1 year ago
Updated 24 February 2023, over 1 year ago

Problem/Motivation

Found working on 📌 Finalize \Drupal\automatic_updates\Development\Converter script to update core MR Fixed

raw output (not all of these are problems with phpstan there may be problems with the conversion)

Running PHPStan on changed files.
 ------ -------------------------------------------------- 
  Line   core/modules/auto_updates/src/BatchProcessor.php  
 ------ -------------------------------------------------- 
  114    Variable $stage_id might not be defined.          
 ------ -------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------- 
  Line   core/modules/auto_updates/src/Updater.php                                                  
 ------ ------------------------------------------------------------------------------------------- 
  41     Constructor of class Drupal\auto_updates\Updater has an unused parameter $config_factory.  
 ------ ------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------ 
  Line   core/modules/auto_updates/src/Validator/StagedProjectsValidator.php           
 ------ ------------------------------------------------------------------------------ 
  128    Variable $version_change_messages in empty() always exists and is not falsy.  
 ------ ------------------------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------------------------------------- 
  Line   core/modules/auto_updates/tests/src/Functional/ClickableHelpTest.php                                         
 ------ ------------------------------------------------------------------------------------------------------------- 
  35     Access to an undefined property Drupal\Tests\auto_updates\Functional\ClickableHelpTest::$checkerRunnerUser.  
  44     Access to an undefined property Drupal\Tests\auto_updates\Functional\ClickableHelpTest::$checkerRunnerUser.  
 ------ ------------------------------------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------------- 
  Line   core/modules/auto_updates/tests/src/Kernel/StatusCheck/CronFrequencyValidatorTest.php          
 ------ ----------------------------------------------------------------------------------------------- 
  47     Anonymous class extends @internal class Drupal\auto_updates\Validator\CronFrequencyValidator.  
 ------ ----------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------ 
  Line   core/modules/package_manager/src/Path.php                   
 ------ ------------------------------------------------------------ 
  811    Function strtolower invoked with 2 parameters, 1 required.  
 ------ ------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------------------- 
  Line   core/modules/package_manager/tests/modules/fixture_manipulator/src/FixtureManipulator.php  
 ------ ------------------------------------------------------------------------------------------- 
  218    Variable $install_json_package might not be defined.                                       
 ------ ------------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   core/modules/package_manager/tests/src/Kernel/StageOwnershipTest.php                                                                                          
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  269    Method class@anonymous/core/modules/package_manager/tests/src/Kernel/StageOwnershipTest.php:259::chmod() should return bool but return statement is missing.  
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------- 
  Line   core/modules/package_manager/tests/src/Kernel/SymlinkValidatorTest.php                           
 ------ ------------------------------------------------------------------------------------------------- 
  114    Call to an undefined method Drupal\Tests\package_manager\Kernel\SymlinkValidatorTest::reveal().  
 ------ ------------------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   core/modules/package_manager/tests/src/Traits/ValidationTestTrait.php (in context of class Drupal\Tests\auto_updates\Functional\StatusCheckTest)  
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------- 
  100    Call to an undefined method Drupal\Tests\auto_updates\Functional\StatusCheckTest::getStringTranslationStub().                                     
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   core/modules/package_manager/tests/src/Traits/ValidationTestTrait.php (in context of class Drupal\Tests\auto_updates\Functional\UpdaterFormTestBase)  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------ 
  100    Call to an undefined method Drupal\Tests\auto_updates\Functional\UpdaterFormTestBase::getStringTranslationStub().                                     
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   core/modules/package_manager/tests/src/Traits/ValidationTestTrait.php (in context of class Drupal\Tests\auto_updates\Kernel\AutoUpdatesKernelTestBase)  
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- 
  100    Call to an undefined method Drupal\Tests\auto_updates\Kernel\AutoUpdatesKernelTestBase::getStringTranslationStub().                                     
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   core/modules/package_manager/tests/src/Traits/ValidationTestTrait.php (in context of class Drupal\Tests\package_manager\Kernel\PackageManagerKernelTestBase)  
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  100    Call to an undefined method Drupal\Tests\package_manager\Kernel\PackageManagerKernelTestBase::getStringTranslationStub().                                     
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   core/modules/package_manager/tests/src/Traits/ValidationTestTrait.php (in context of class Drupal\Tests\package_manager\Unit\StageNotInActiveValidatorTest)  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  67     Access to an undefined property Drupal\Tests\package_manager\Unit\StageNotInActiveValidatorTest::$container.                                                 
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 [ERROR] Found 15 errors                                                                                                

But here is at least 1 example where it just looks we aren't catching problems

 ------ ------------------------------------------------------------------------------ 
  Line   core/modules/auto_updates/src/Validator/StagedProjectsValidator.php           
 ------ ------------------------------------------------------------------------------ 
  128    Variable $version_change_messages in empty() always exists and is not falsy.  
 ------ ------------------------------------------------------------------------------ 

Steps to reproduce

Proposed resolution

Figure if phpstan is being run on drupalci for this module. Could it be this problems are just existing problems and new problems would be caught3341974

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇺🇸United States tedbow Ithaca, NY, USA

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

Comments & Activities

Production build 0.69.0 2024