Resolve type issues caught by PHPStan usage in Project Browser

Created on 23 January 2025, 5 days ago

Problem/Motivation

πŸ“Œ Increase PHPStan level and ensure issues exist for each entry in the baseline Active increases the PHPStan level in Project Browser and surfaces three errors caused by Package Manager.

Steps to reproduce

Remove the Package Manager specific ignores in Project Browser
Run PHPStan

 ------ -------------------------------------------------------------------------------------------------------------- 
  Line   tests/src/Kernel/CoreNotUpdatedValidatorTest.php                                                              
 ------ -------------------------------------------------------------------------------------------------------------- 
  31     Method Drupal\fixture_manipulator\FixtureManipulator::commitChanges() invoked with 0 parameters, 1 required.  
         πŸͺͺ  arguments.count                                                                                           
  76     Call to an undefined method object::setCorePackageVersion().                                                  
         πŸͺͺ  method.notFound                                                                                           
  87     Dead catch - Drupal\package_manager\Exception\StageEventException is never thrown in the try block.           
         πŸͺͺ  catch.neverThrown                                                                                         
 ------ -------------------------------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------- 
  Line   tests/src/Kernel/InstallerTest.php                                                                            
 ------ -------------------------------------------------------------------------------------------------------------- 
  47     Method Drupal\fixture_manipulator\FixtureManipulator::commitChanges() invoked with 0 parameters, 1 required.  
         πŸͺͺ  arguments.count                                                                                           
 ------ -------------------------------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------- 
  Line   tests/src/Kernel/PackageNotInstalledValidatorTest.php                                                         
 ------ -------------------------------------------------------------------------------------------------------------- 
  66     Method Drupal\fixture_manipulator\FixtureManipulator::commitChanges() invoked with 0 parameters, 1 required.  
         πŸͺͺ  arguments.count  

Proposed resolution

  1. Switch from self:: to static:: in \Drupal\fixture_manipulator\FixtureManipulator and subclasses
  2. Add return type to \Drupal\Tests\package_manager\Traits\FixtureManipulatorTrait::getStageFixtureManipulator()
  3. Add missing @throws to \Drupal\package_manager\StageBase::apply()

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.1 πŸ”₯

Component

package_manager.module

Created by

πŸ‡ΊπŸ‡ΈUnited States tim.plunkett Philadelphia

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