Problem/Motivation

The (recently revived) updated-deps daily GitLab CI job on 11.x fails PHPStan with a cheery:

 ------ --------------------------------------------------------------------------------- 
  Line   core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php  
 ------ --------------------------------------------------------------------------------- 
  132    Variable $test_meta in empty() always exists and is not falsy.                   
  153    Variable $test_meta in empty() always exists and is not falsy.                   
 ------ --------------------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------------------- 
  Line   core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php                         
 ------ ---------------------------------------------------------------------------------- 
         Ignored error pattern #^Variable \$depth_count might not be                       
         defined\.$# in path                                                               
         /builds/project/drupal/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php  
         was not matched in reported errors.                                               
 ------ ---------------------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------------------------------------------- 
  Line   core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php                         
 ------ ---------------------------------------------------------------------------------------------------------- 
         Ignored error pattern #^Variable \$entity might not be defined\.$# in                                     
         path                                                                                                      
         /builds/project/drupal/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php  
         was not matched in reported errors.                                                                       
 ------ ---------------------------------------------------------------------------------------------------------- 
 [ERROR] Found 4 errors   

Steps to reproduce

Look at the output of the scheduled runs (https://git.drupalcode.org/project/drupal/-/pipeline_schedules) and look at the update-deps jobs

The above failure can be seen at https://git.drupalcode.org/project/drupal/-/jobs/1090935

Proposed resolution

- Bump phpstan/phpstan-phpunit to its latest version (currently 1.3.16)
- Create new PHPStan baseline ($ vendor/bin/phpstan analyze --configuration=core/phpstan.neon.dist --generate-baseline core/.phpstan-baseline.php)
- Set version constraint of phpstan/phpstan-phpunit to its latest version in composer.*, since the new PHPStan baseline wont pass in any lower version.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3431227

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Spokje created an issue. See original summary.

Spokje’s picture

Status: Active » Needs review
longwave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @Spokje for keeping up with this.

longwave’s picture

Think we should also backport this to 10.3.x if we can.

alexpott’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed 7de259e and pushed to 11.x. Thanks!
Committed fcabbe1 and pushed to 10.3.x. Thanks!

Backported to 10.3.x by carrying out the step in the issue summary on 10.3.x and comparing the diffs.

  • alexpott committed fcabbe1f on 10.3.x
    Issue #3431227 by Spokje, longwave: Update phpstan/phpstan-phpunit and...

  • alexpott committed 7de259e7 on 11.x
    Issue #3431227 by Spokje, longwave: Update phpstan/phpstan-phpunit and...

Status: Fixed » Closed (fixed)

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