Problem/Motivation

PHPStan 2.0.0 was released on Nov 11, 2024. Bump to it.

Proposed resolution

  • Update to PHPStan 2.x.
  • Fix all new errors (less than 10) except missingType.generics errors like the one below (of which there are 85), which will be added to the baseline.
  • When refreshing the baseline, the identifier is now part of the array (it used to be a comment).
 ------ ---------------------------------------------------------------------------------- 
  Line   core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php                  
 ------ ---------------------------------------------------------------------------------- 
  1154   Method                                                                            
         Drupal\Tests\Core\Render\RendererPlaceholdersTest::setupThemeManagerForDetails()  
         return type with generic class                                                    
         PHPUnit\Framework\MockObject\Builder\InvocationMocker does not                    
         specify its types: TMockedClass                                                   
         🪪  missingType.generics                                                          
 ------ ---------------------------------------------------------------------------------- 

There is one MR:

phpstan2_with1 Updates to PHPStan 2 and allows use of PHPStan 1.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

PHPStan has been upgraded to 2.0.4. Backward compatibility is provided so you can still install PHPStan 1.x until you are ready to upgrade.

Issue fork drupal-3486713

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

mondrake created an issue. See original summary.

spokje’s picture

This needs a mglaman/phpstan-drupal that works with phpstan/phpstan:^2.0 AFAICT

gorkagr’s picture

In the core-dev (https://github.com/drupal/core-dev/blob/11.0.6/composer.json) is required both phpstan/phpstan and mglaman/phpstan-drupal, so indeed it is needed an update of the latest too

mondrake’s picture

Title: Bump PHPStan to version 2.0.0 » [PP-upstream] Bump PHPStan to version 2.0.0
Status: Active » Postponed

This needs a mglaman/phpstan-drupal that works with phpstan/phpstan:^2.0

Postponed on that.

spokje’s picture

mstrelan’s picture

I believe this means we could remove bleeding edge from phpstan config. To be discussed if that's something we want to do though.

mondrake’s picture

Title: [PP-upstream] Bump PHPStan to version 2.0.0 » Bump PHPStan to version 2.0.0
Status: Postponed » Active

https://github.com/mglaman/phpstan-drupal/releases/tag/2.0.0 is out, supporting PHPStan 2. This is unblocked now.

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

ptmkenny’s picture

After updating to PHPStan 2, there are two coversMethod errors:

 ------ ----------------------------------------------------------------- 
  Line   core/tests/Drupal/Tests/Core/Layout/LayoutPluginManagerTest.php  
 ------ ----------------------------------------------------------------- 
  365    @covers value                                                    
         \Drupal\Core\Layout\LayoutPluginManager::getLayoutOptions        
                                                                          
         Test that modules and themes can alter the list of layouts.      
         references an invalid method.                                    
         🪪  phpunit.coversMethod                                         
 ------ ----------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------- 
  Line   core/tests/Drupal/Tests/Core/State/StateTest.php                      
 ------ ---------------------------------------------------------------------- 
  328    @covers value \Drupal\Core\State\State::delete                        
                                                                               
         Ensure that deleting clears some static cache. references an invalid  
         method.                                                               
         🪪  phpunit.coversMethod                                              
 ------ ---------------------------------------------------------------------- 

I am confused about the above errors because in PHPStorm, I can jump from the @covers getLayoutOptions and @covers delete to the implementations, so I don't understand why PHPStan is flagging this (these were previously fixed in core in #3351095: Fix PHPStan L1 errors "@covers value foo references an invalid class or function.").

There are also 90 missingType.generics errors:

 ------ ---------------------------------------------------------------------------------- 
  Line   core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php                  
 ------ ---------------------------------------------------------------------------------- 
  1154   Method                                                                            
         Drupal\Tests\Core\Render\RendererPlaceholdersTest::setupThemeManagerForDetails()  
         return type with generic class                                                    
         PHPUnit\Framework\MockObject\Builder\InvocationMocker does not                    
         specify its types: TMockedClass                                                   
         🪪  missingType.generics                                                          
 ------ ---------------------------------------------------------------------------------- 

Should these errors be fixed in this issue, ignored in phpstan.neon.dist, or added to a baseline?

spokje’s picture

Thanks for the hard work @ptmkenny

The first two errors you mentioned are caused by there being text after the @covers

So for example core/tests/Drupal/Tests/Core/State/StateTest.php

  /**
   * Tests both get() & delete() method.
   *
   * Here testing the key and value after deleting the key's value.
   *
   * @covers ::get
   * @covers ::delete
   *
   * Ensure that deleting clears some static cache.
   */

So if we put that last line before the @covers ::get PHPStan should be much happier.

The missingType.generics are much harder to fix and we _could_ suppress them, so the behaviour on those would be the same as in PHPStan 1.x, with:

parameters:
	ignoreErrors:
		-
			identifier: missingType.generics

https://github.com/phpstan/phpstan/blob/2.0.x/UPGRADING.md#removed-optio...

ptmkenny’s picture

@spokje Ok, thanks! I fixed the @covers and updated one ignore in the baseline that is now processed differently, and I set missingType.generics to ignore.

ptmkenny’s picture

Status: Active » Needs work

The phpunit phpstan test is failing:

Component Test Does Not Extend Core Test (Drupal\PHPStan\Tests\ComponentTestDoesNotExtendCoreTest)
 ✔ Rule
Ensure PHPStan Versions Match (Drupal\PHPStan\Tests\EnsurePHPStanVersionsMatch)
 ✘ Versions
   │
   │ Failed asserting that two strings are identical.
   │ --- Expected
   │ +++ Actual
   │ @@ @@
   │ -'1.12.12'
   │ +'2.0.3'
   │
   │ /builds/issue/drupal-3486713/core/tests/PHPStan/tests/EnsurePHPStanVersionsMatchTest.php:17

That test is:

/**
 * Tests that PHPStan versions match.
 */
class EnsurePHPStanVersionsMatchTest extends TestCase {

  public function testVersions(): void {
    $test_composer = json_decode(file_get_contents(__DIR__ . '/../composer.json'), TRUE);
    $drupal_composer = json_decode(file_get_contents(__DIR__ . '/../../../../composer/Metapackage/PinnedDevDependencies/composer.json'), TRUE);
    $this->assertSame($test_composer['require-dev']['phpstan/phpstan'], $drupal_composer['require']['phpstan/phpstan']);
  }

}
 

I don't understand why this test is failing, though; on my local machine, both composer.json and the metapackage PinnedDevDependencies composer.json have phpstan 2.

spokje’s picture

Nice,

The only failing test now is an annoying one, which always gets me.

In core/tests/PHPStan/composer.json the version of phpstan/phpstan should match the version that is in composer.json.

longwave’s picture

Is it possible to allow both PHPStan 1 and 2 in composer.json? While core can move to v2 all at once, contrib (including the CI templates) might not want to do so just yet, so allowing a downgrade might be useful.

ptmkenny’s picture

Issue summary: View changes
ptmkenny’s picture

Status: Needs work » Needs review

@spokje Ok, it looks like the version in core/tests/PHPStan/composer.json is hard-coded to the latest version, so I updated that.

@longwave I created a new branch, phpstan2_with1, which allows for both PHPStan 2 and 1.

All tests are passing now in both branches, so I updated the issue summary and am setting this to "Needs review".

mondrake’s picture

Status: Needs review » Needs work

ptmkenny changed the visibility of the branch phpstan2 to hidden.

ptmkenny’s picture

@mondrake: The list of missingType.generics violations is below.

The question is whether these should be added to the baseline or ignored as a group.

The PHPStan docs on missingType.generics list over a dozen rules that could report this error. So it may be worthwhile to find a more specific rule, or to ignore a string like "return type with generic class... does not specify its types".

@spokje mentioned that it might be better to ignore them as a group in the phpstan.neon.dist.

I am happy to do it either way; what does everyone think?

 ------ ---------------------------------------------------------------------------------- 
  Line   composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php                    
 ------ ---------------------------------------------------------------------------------- 
  118    Method                                                                            
         Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldFileCollection::getIterator()  
         return type with generic class ArrayIterator does not specify its                 
         types: TKey, TValue                                                               
         🪪  missingType.generics                                                          
 ------ ---------------------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------------ 
  Line   core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionClass.php       
 ------ ------------------------------------------------------------------------------ 
  182    Method                                                                        
         Drupal\Component\Annotation\Doctrine\StaticReflectionClass::getInterfaces()   
         return type with generic class ReflectionClass does not specify its           
         types: T                                                                      
         🪪  missingType.generics                                                      
  206    Method                                                                        
         Drupal\Component\Annotation\Doctrine\StaticReflectionClass::getParentClass()  
         return type with generic class ReflectionClass does not specify its           
         types: T                                                                      
         🪪  missingType.generics                                                      
  270    Method                                                                        
         Drupal\Component\Annotation\Doctrine\StaticReflectionClass::getTraits()       
         return type with generic class ReflectionClass does not specify its           
         types: T                                                                      
         🪪  missingType.generics                                                      
 ------ ------------------------------------------------------------------------------ 
 ------ -------------------------------------------------------------------- 
  Line   core/lib/Drupal/Component/Plugin/LazyPluginCollection.php           
 ------ -------------------------------------------------------------------- 
  145    Method Drupal\Component\Plugin\LazyPluginCollection::getIterator()  
         return type with generic class ArrayIterator does not specify its   
         types: TKey, TValue                                                 
         🪪  missingType.generics                                            
 ------ -------------------------------------------------------------------- 
 ------ --------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/Config/Schema/ArrayElement.php                  
 ------ --------------------------------------------------------------------- 
  136    Method Drupal\Core\Config\Schema\ArrayElement::getIterator() return  
         type with generic class ArrayIterator does not specify its types:    
         TKey, TValue                                                         
         🪪  missingType.generics                                             
 ------ --------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/Config/TypedConfigManager.php                     
 ------ ----------------------------------------------------------------------- 
  81     Method Drupal\Core\Config\TypedConfigManager::get() return type with   
         generic interface Drupal\Core\TypedData\TraversableTypedDataInterface  
         does not specify its types: I, T                                       
         🪪  missingType.generics                                               
  201    Method Drupal\Core\Config\TypedConfigManager::getStaticTypeRoot()      
         return type with generic interface                                     
         Drupal\Core\TypedData\TraversableTypedDataInterface does not specify   
         its types: I, T                                                        
         🪪  missingType.generics                                               
  427    Method Drupal\Core\Config\TypedConfigManager::createFromNameAndData()  
         return type with generic interface                                     
         Drupal\Core\TypedData\TraversableTypedDataInterface does not specify   
         its types: I, T                                                        
         🪪  missingType.generics                                               
 ------ ----------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/Config/TypedConfigManagerInterface.php              
 ------ ------------------------------------------------------------------------- 
  26     Method Drupal\Core\Config\TypedConfigManagerInterface::get() return      
         type with generic interface                                              
         Drupal\Core\TypedData\TraversableTypedDataInterface does not specify     
         its types: I, T                                                          
         🪪  missingType.generics                                                 
  88     Method                                                                   
         Drupal\Core\Config\TypedConfigManagerInterface::createFromNameAndData()  
         return type with generic interface                                       
         Drupal\Core\TypedData\TraversableTypedDataInterface does not specify     
         its types: I, T                                                          
         🪪  missingType.generics                                                 
 ------ ------------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/Entity/ContentEntityBase.php                     
 ------ ---------------------------------------------------------------------- 
  607    Method Drupal\Core\Entity\ContentEntityBase::getTranslatedField()     
         return type with generic interface                                    
         Drupal\Core\Field\FieldItemListInterface does not specify its types:  
         T                                                                     
         🪪  missingType.generics                                              
  690    Method Drupal\Core\Entity\ContentEntityBase::getIterator() return     
         type with generic class ArrayIterator does not specify its types:     
         TKey, TValue                                                          
         🪪  missingType.generics                                              
 ------ ---------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/Entity/ContentEntityNullStorage.php              
 ------ ---------------------------------------------------------------------- 
  114    Method                                                                
         Drupal\Core\Entity\ContentEntityNullStorage::readFieldItemsToPurge()  
         return type with generic interface                                    
         Drupal\Core\Field\FieldItemListInterface does not specify its types:  
         T                                                                     
         🪪  missingType.generics                                              
 ------ ---------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php              
 ------ ---------------------------------------------------------------------- 
  580    Method                                                                
         Drupal\Core\Entity\ContentEntityStorageBase::readFieldItemsToPurge()  
         return type with generic interface                                    
         Drupal\Core\Field\FieldItemListInterface does not specify its types:  
         T                                                                     
         🪪  missingType.generics                                              
 ------ ---------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/Entity/Plugin/DataType/ConfigEntityAdapter.php    
 ------ ----------------------------------------------------------------------- 
  72     Method                                                                 
         Drupal\Core\Entity\Plugin\DataType\ConfigEntityAdapter::getIterator()  
         return type with generic class ArrayIterator does not specify its      
         types: TKey, TValue                                                    
         🪪  missingType.generics                                               
 ------ ----------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php      
 ------ ------------------------------------------------------------------- 
  165    Method                                                             
         Drupal\Core\Entity\Plugin\DataType\EntityAdapter::getIterator()    
         return type with generic class ArrayIterator does not specify its  
         types: TKey, TValue                                                
         🪪  missingType.generics                                           
 ------ ------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php              
 ------ ------------------------------------------------------------------------- 
  1640   Method                                                                   
         Drupal\Core\Entity\Sql\SqlContentEntityStorage::readFieldItemsToPurge()  
         return type with generic interface                                       
         Drupal\Core\Field\FieldItemListInterface does not specify its types:     
         T                                                                        
         🪪  missingType.generics                                                 
 ------ ------------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/Field/FieldTypePluginManager.php                 
 ------ ---------------------------------------------------------------------- 
  83     Method                                                                
         Drupal\Core\Field\FieldTypePluginManager::createFieldItemList()       
         return type with generic interface                                    
         Drupal\Core\Field\FieldItemListInterface does not specify its types:  
         T                                                                     
         🪪  missingType.generics                                              
 ------ ---------------------------------------------------------------------- 
 ------ -------------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/Field/FieldTypePluginManagerInterface.php            
 ------ -------------------------------------------------------------------------- 
  34     Method                                                                    
         Drupal\Core\Field\FieldTypePluginManagerInterface::createFieldItemList()  
         return type with generic interface                                        
         Drupal\Core\Field\FieldItemListInterface does not specify its types:      
         T                                                                         
         🪪  missingType.generics                                                  
 ------ -------------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/Plugin/Discovery/DirectoryWithMetadataDiscovery.php             
 ------ ------------------------------------------------------------------------------------- 
  44     Method                                                                               
         Drupal\Core\Plugin\Discovery\DirectoryWithMetadataDiscovery::getDirectoryIterator()  
         return type with generic class RecursiveIteratorIterator does not                    
         specify its types: T                                                                 
         🪪  missingType.generics                                                             
 ------ ------------------------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/Template/Attribute.php                            
 ------ ----------------------------------------------------------------------- 
  362    Method Drupal\Core\Template\Attribute::getIterator() return type with  
         generic class ArrayIterator does not specify its types: TKey, TValue   
         🪪  missingType.generics                                               
 ------ ----------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/Template/AttributeArray.php                       
 ------ ----------------------------------------------------------------------- 
  80     Method Drupal\Core\Template\AttributeArray::getIterator() return type  
         with generic class ArrayIterator does not specify its types: TKey,     
         TValue                                                                 
         🪪  missingType.generics                                               
 ------ ----------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------------------ 
  Line   core/lib/Drupal/Core/TypedData/ComputedItemListTrait.php (in context                
         of class                                                                            
         Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList)                
 ------ ------------------------------------------------------------------------------------ 
  129    Method                                                                              
         Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList::getIterator()  
         return type with generic class ArrayIterator does not specify its                   
         types: TKey, TValue                                                                 
         🪪  missingType.generics                                                            
 ------ ------------------------------------------------------------------------------------ 
 ------ ----------------------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/TypedData/ComputedItemListTrait.php (in context               
         of class                                                                           
         Drupal\entity_test\Plugin\Field\ComputedReferenceTestFieldItemList)                
 ------ ----------------------------------------------------------------------------------- 
  129    Method                                                                             
         Drupal\entity_test\Plugin\Field\ComputedReferenceTestFieldItemList::getIterator()  
         return type with generic class ArrayIterator does not specify its                  
         types: TKey, TValue                                                                
         🪪  missingType.generics                                                           
 ------ ----------------------------------------------------------------------------------- 
 ------ -------------------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/TypedData/ComputedItemListTrait.php (in context            
         of class                                                                        
         Drupal\entity_test\Plugin\Field\ComputedTestBundleFieldItemList)                
 ------ -------------------------------------------------------------------------------- 
  129    Method                                                                          
         Drupal\entity_test\Plugin\Field\ComputedTestBundleFieldItemList::getIterator()  
         return type with generic class ArrayIterator does not specify its               
         types: TKey, TValue                                                             
         🪪  missingType.generics                                                        
 ------ -------------------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/TypedData/ComputedItemListTrait.php (in context                 
         of class                                                                             
         Drupal\entity_test\Plugin\Field\ComputedTestCacheableIntegerItemList)                
 ------ ------------------------------------------------------------------------------------- 
  129    Method                                                                               
         Drupal\entity_test\Plugin\Field\ComputedTestCacheableIntegerItemList::getIterator()  
         return type with generic class ArrayIterator does not specify its                    
         types: TKey, TValue                                                                  
         🪪  missingType.generics                                                             
 ------ ------------------------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------------------ 
  Line   core/lib/Drupal/Core/TypedData/ComputedItemListTrait.php (in context                
         of class                                                                            
         Drupal\entity_test\Plugin\Field\ComputedTestCacheableStringItemList)                
 ------ ------------------------------------------------------------------------------------ 
  129    Method                                                                              
         Drupal\entity_test\Plugin\Field\ComputedTestCacheableStringItemList::getIterator()  
         return type with generic class ArrayIterator does not specify its                   
         types: TKey, TValue                                                                 
         🪪  missingType.generics                                                            
 ------ ------------------------------------------------------------------------------------ 
 ------ -------------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/TypedData/ComputedItemListTrait.php (in context      
         of class Drupal\entity_test\Plugin\Field\ComputedTestFieldItemList)       
 ------ -------------------------------------------------------------------------- 
  129    Method                                                                    
         Drupal\entity_test\Plugin\Field\ComputedTestFieldItemList::getIterator()  
         return type with generic class ArrayIterator does not specify its         
         types: TKey, TValue                                                       
         🪪  missingType.generics                                                  
 ------ -------------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/TypedData/ComputedItemListTrait.php (in context  
         of class Drupal\path\Plugin\Field\FieldType\PathFieldItemList)        
 ------ ---------------------------------------------------------------------- 
  129    Method                                                                
         Drupal\path\Plugin\Field\FieldType\PathFieldItemList::getIterator()   
         return type with generic class ArrayIterator does not specify its     
         types: TKey, TValue                                                   
         🪪  missingType.generics                                              
 ------ ---------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php           
 ------ ---------------------------------------------------------------------- 
  235    Method Drupal\Core\TypedData\Plugin\DataType\ItemList::getIterator()  
         return type with generic class ArrayIterator does not specify its     
         types: TKey, TValue                                                   
         🪪  missingType.generics                                              
 ------ ---------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php             
 ------ ------------------------------------------------------------------- 
  187    Method Drupal\Core\TypedData\Plugin\DataType\Map::getIterator()    
         return type with generic class ArrayIterator does not specify its  
         types: TKey, TValue                                                
         🪪  missingType.generics                                           
 ------ ------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/TypedData/TypedData.php                           
 ------ ----------------------------------------------------------------------- 
  162    Method Drupal\Core\TypedData\TypedData::getRoot() return type with     
         generic interface Drupal\Core\TypedData\TraversableTypedDataInterface  
         does not specify its types: I, T                                       
         🪪  missingType.generics                                               
  195    Method Drupal\Core\TypedData\TypedData::getParent() return type with   
         generic interface Drupal\Core\TypedData\TraversableTypedDataInterface  
         does not specify its types: I, T                                       
         🪪  missingType.generics                                               
 ------ ----------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/TypedData/TypedDataInterface.php                 
 ------ ---------------------------------------------------------------------- 
  124    Method Drupal\Core\TypedData\TypedDataInterface::getParent() return   
         type with generic interface                                           
         Drupal\Core\TypedData\TraversableTypedDataInterface does not specify  
         its types: I, T                                                       
         🪪  missingType.generics                                              
  135    Method Drupal\Core\TypedData\TypedDataInterface::getRoot() return     
         type with generic interface                                           
         Drupal\Core\TypedData\TraversableTypedDataInterface does not specify  
         its types: I, T                                                       
         🪪  missingType.generics                                              
 ------ ---------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------- 
  Line   core/modules/jsonapi/src/JsonApiResource/Data.php                      
 ------ ----------------------------------------------------------------------- 
  72     Method Drupal\jsonapi\JsonApiResource\Data::getIterator() return type  
         with generic class ArrayIterator does not specify its types: TKey,     
         TValue                                                                 
         🪪  missingType.generics                                               
 ------ ----------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   core/modules/jsonapi/src/JsonApiResource/ErrorCollection.php          
 ------ ---------------------------------------------------------------------- 
  50     Method Drupal\jsonapi\JsonApiResource\ErrorCollection::getIterator()  
         return type with generic class ArrayIterator does not specify its     
         types: TKey, TValue                                                   
         🪪  missingType.generics                                              
 ------ ---------------------------------------------------------------------- 
 ------ --------------------------------------------------------------------- 
  Line   core/modules/jsonapi/src/JsonApiResource/LinkCollection.php          
 ------ --------------------------------------------------------------------- 
  65     Method Drupal\jsonapi\JsonApiResource\LinkCollection::getIterator()  
         return type with generic class ArrayIterator does not specify its    
         types: TKey, TValue                                                  
         🪪  missingType.generics                                             
 ------ --------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------------- 
  Line   core/modules/jsonapi/src/JsonApiResource/ResourceObject.php                  
 ------ ----------------------------------------------------------------------------- 
  302    Method                                                                       
         Drupal\jsonapi\JsonApiResource\ResourceObject::extractContentEntityFields()  
         return type with generic interface                                           
         Drupal\Core\Field\FieldItemListInterface does not specify its types:         
         T                                                                            
         🪪  missingType.generics                                                     
 ------ ----------------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------- 
  Line   core/modules/jsonapi/src/Normalizer/DataNormalizer.php                 
 ------ ----------------------------------------------------------------------- 
  18     Method Drupal\jsonapi\Normalizer\DataNormalizer::normalize() return    
         type with generic class ArrayObject does not specify its types: TKey,  
         TValue                                                                 
         🪪  missingType.generics                                               
 ------ ----------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   core/modules/jsonapi/src/Normalizer/EntityDenormalizerBase.php        
 ------ ---------------------------------------------------------------------- 
  77     Method Drupal\jsonapi\Normalizer\EntityDenormalizerBase::normalize()  
         return type with generic class ArrayObject does not specify its       
         types: TKey, TValue                                                   
         🪪  missingType.generics                                              
 ------ ---------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------ 
  Line   core/modules/jsonapi/src/Normalizer/EntityReferenceFieldNormalizer.php  
 ------ ------------------------------------------------------------------------ 
  30     Method                                                                  
         Drupal\jsonapi\Normalizer\EntityReferenceFieldNormalizer::normalize()   
         return type with generic class ArrayObject does not specify its         
         types: TKey, TValue                                                     
         🪪  missingType.generics                                                
 ------ ------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------- 
  Line   core/modules/jsonapi/src/Normalizer/FieldItemNormalizer.php        
 ------ ------------------------------------------------------------------- 
  57     Method Drupal\jsonapi\Normalizer\FieldItemNormalizer::normalize()  
         return type with generic class ArrayObject does not specify its    
         types: TKey, TValue                                                
         🪪  missingType.generics                                           
 ------ ------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------- 
  Line   core/modules/jsonapi/src/Normalizer/FieldNormalizer.php                
 ------ ----------------------------------------------------------------------- 
  26     Method Drupal\jsonapi\Normalizer\FieldNormalizer::normalize() return   
         type with generic class ArrayObject does not specify its types: TKey,  
         TValue                                                                 
         🪪  missingType.generics                                               
 ------ ----------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------- 
  Line   core/modules/jsonapi/src/Normalizer/HttpExceptionNormalizer.php        
 ------ ----------------------------------------------------------------------- 
  44     Method Drupal\jsonapi\Normalizer\HttpExceptionNormalizer::normalize()  
         return type with generic class ArrayObject does not specify its        
         types: TKey, TValue                                                    
         🪪  missingType.generics                                               
 ------ ----------------------------------------------------------------------- 
 ------ --------------------------------------------------------------------------- 
  Line   core/modules/jsonapi/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php  
 ------ --------------------------------------------------------------------------- 
  170    Method                                                                     
         Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer::normalize()   
         return type with generic class ArrayObject does not specify its            
         types: TKey, TValue                                                        
         🪪  missingType.generics                                                   
 ------ --------------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------ 
  Line   core/modules/jsonapi/src/Normalizer/LinkCollectionNormalizer.php  
 ------ ------------------------------------------------------------------ 
  84     Method                                                            
         Drupal\jsonapi\Normalizer\LinkCollectionNormalizer::normalize()   
         return type with generic class ArrayObject does not specify its   
         types: TKey, TValue                                               
         🪪  missingType.generics                                          
 ------ ------------------------------------------------------------------ 
 ------ ---------------------------------------------------------------------- 
  Line   core/modules/jsonapi/src/Normalizer/RelationshipNormalizer.php        
 ------ ---------------------------------------------------------------------- 
  18     Method Drupal\jsonapi\Normalizer\RelationshipNormalizer::normalize()  
         return type with generic class ArrayObject does not specify its       
         types: TKey, TValue                                                   
         🪪  missingType.generics                                              
 ------ ---------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   core/modules/jsonapi/src/Normalizer/ResourceIdentifierNormalizer.php  
 ------ ---------------------------------------------------------------------- 
  46     Method                                                                
         Drupal\jsonapi\Normalizer\ResourceIdentifierNormalizer::normalize()   
         return type with generic class ArrayObject does not specify its       
         types: TKey, TValue                                                   
         🪪  missingType.generics                                              
 ------ ---------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------ 
  Line   core/modules/jsonapi/src/Normalizer/ResourceObjectNormalizer.php  
 ------ ------------------------------------------------------------------ 
  52     Method                                                            
         Drupal\jsonapi\Normalizer\ResourceObjectNormalizer::normalize()   
         return type with generic class ArrayObject does not specify its   
         types: TKey, TValue                                               
         🪪  missingType.generics                                          
 ------ ------------------------------------------------------------------ 
 ------ -------------------------------------------------------------------------------------------- 
  Line   core/modules/jsonapi/src/Normalizer/Value/TemporaryArrayObjectThrowingExceptions.php        
 ------ -------------------------------------------------------------------------------------------- 
  106    Method                                                                                      
         Drupal\jsonapi\Normalizer\Value\TemporaryArrayObjectThrowingExceptions::getIteratorClass()  
         return type with generic class ArrayIterator does not specify its                           
         types: TKey, TValue                                                                         
         🪪  missingType.generics                                                                    
 ------ -------------------------------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   core/modules/jsonapi/src/Serializer/Serializer.php                    
 ------ ---------------------------------------------------------------------- 
  60     Method Drupal\jsonapi\Serializer\Serializer::normalize() return type  
         with generic class ArrayObject does not specify its types: TKey,      
         TValue                                                                
         🪪  missingType.generics                                              
 ------ ---------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------------------------------- 
  Line   core/modules/jsonapi/tests/modules/jsonapi_test_data_type/src/Normalizer/StringNormalizer.php  
 ------ ----------------------------------------------------------------------------------------------- 
  19     Method                                                                                         
         Drupal\jsonapi_test_data_type\Normalizer\StringNormalizer::normalize()                         
         return type with generic class ArrayObject does not specify its                                
         types: TKey, TValue                                                                            
         🪪  missingType.generics                                                                       
 ------ ----------------------------------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------------------------------------------- 
  Line   core/modules/jsonapi/tests/modules/jsonapi_test_data_type/src/Normalizer/TraversableObjectNormalizer.php  
 ------ ---------------------------------------------------------------------------------------------------------- 
  18     Method                                                                                                    
         Drupal\jsonapi_test_data_type\Normalizer\TraversableObjectNormalizer::normalize()                         
         return type with generic class ArrayObject does not specify its                                           
         types: TKey, TValue                                                                                       
         🪪  missingType.generics                                                                                  
 ------ ---------------------------------------------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------------------- 
  Line   core/modules/jsonapi/tests/modules/jsonapi_test_data_type/src/TraversableObject.php  
 ------ ------------------------------------------------------------------------------------- 
  17     Method Drupal\jsonapi_test_data_type\TraversableObject::getIterator()                
         return type with generic class ArrayIterator does not specify its                    
         types: TKey, TValue                                                                  
         🪪  missingType.generics                                                             
 ------ ------------------------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------------------------------ 
  Line   core/modules/jsonapi/tests/modules/jsonapi_test_field_type/src/Normalizer/StringNormalizer.php  
 ------ ------------------------------------------------------------------------------------------------ 
  19     Method                                                                                          
         Drupal\jsonapi_test_field_type\Normalizer\StringNormalizer::normalize()                         
         return type with generic class ArrayObject does not specify its                                 
         types: TKey, TValue                                                                             
         🪪  missingType.generics                                                                        
 ------ ------------------------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------- 
  Line   core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php            
 ------ ------------------------------------------------------------------------- 
  563    Method                                                                   
         Drupal\Tests\migrate\Unit\MigrateExecutableTest::getTestRollbackIdMap()  
         return type with generic class Prophecy\Prophecy\ObjectProphecy does     
         not specify its types: T                                                 
         🪪  missingType.generics                                                 
 ------ ------------------------------------------------------------------------- 
 ------ --------------------------------------------------------------------------------- 
  Line   core/modules/package_manager/tests/src/Kernel/ComposerInspectorTest.php          
 ------ --------------------------------------------------------------------------------- 
  534    Method                                                                           
         Drupal\Tests\package_manager\Kernel\ComposerInspectorTest::mockComposerRunner()  
         return type with generic class Prophecy\Prophecy\ObjectProphecy does             
         not specify its types: T                                                         
         🪪  missingType.generics                                                         
 ------ --------------------------------------------------------------------------------- 
 ------ --------------------------------------------------------------------- 
  Line   core/modules/serialization/src/Normalizer/ComplexDataNormalizer.php  
 ------ --------------------------------------------------------------------- 
  23     Method                                                               
         Drupal\serialization\Normalizer\ComplexDataNormalizer::normalize()   
         return type with generic class ArrayObject does not specify its      
         types: TKey, TValue                                                  
         🪪  missingType.generics                                             
 ------ --------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   core/modules/serialization/src/Normalizer/ConfigEntityNormalizer.php  
 ------ ---------------------------------------------------------------------- 
  15     Method                                                                
         Drupal\serialization\Normalizer\ConfigEntityNormalizer::normalize()   
         return type with generic class ArrayObject does not specify its       
         types: TKey, TValue                                                   
         🪪  missingType.generics                                              
 ------ ---------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------- 
  Line   core/modules/serialization/src/Normalizer/ContentEntityNormalizer.php  
 ------ ----------------------------------------------------------------------- 
  16     Method                                                                 
         Drupal\serialization\Normalizer\ContentEntityNormalizer::normalize()   
         return type with generic class ArrayObject does not specify its        
         types: TKey, TValue                                                    
         🪪  missingType.generics                                               
 ------ ----------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------- 
  Line   core/modules/serialization/src/Normalizer/DateTimeIso8601Normalizer.php  
 ------ ------------------------------------------------------------------------- 
  35     Method                                                                   
         Drupal\serialization\Normalizer\DateTimeIso8601Normalizer::normalize()   
         return type with generic class ArrayObject does not specify its          
         types: TKey, TValue                                                      
         🪪  missingType.generics                                                 
 ------ ------------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------ 
  Line   core/modules/serialization/src/Normalizer/DateTimeNormalizer.php  
 ------ ------------------------------------------------------------------ 
  52     Method                                                            
         Drupal\serialization\Normalizer\DateTimeNormalizer::normalize()   
         return type with generic class ArrayObject does not specify its   
         types: TKey, TValue                                               
         🪪  missingType.generics                                          
 ------ ------------------------------------------------------------------ 
 ------ ---------------------------------------------------------------------------------- 
  Line   core/modules/serialization/src/Normalizer/EntityReferenceFieldItemNormalizer.php  
 ------ ---------------------------------------------------------------------------------- 
  38     Method                                                                            
         Drupal\serialization\Normalizer\EntityReferenceFieldItemNormalizer::normalize()   
         return type with generic class ArrayObject does not specify its                   
         types: TKey, TValue                                                               
         🪪  missingType.generics                                                          
 ------ ---------------------------------------------------------------------------------- 
 ------ -------------------------------------------------------------------- 
  Line   core/modules/serialization/src/Normalizer/ListNormalizer.php        
 ------ -------------------------------------------------------------------- 
  21     Method Drupal\serialization\Normalizer\ListNormalizer::normalize()  
         return type with generic class ArrayObject does not specify its     
         types: TKey, TValue                                                 
         🪪  missingType.generics                                            
 ------ -------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   core/modules/serialization/src/Normalizer/MarkupNormalizer.php        
 ------ ---------------------------------------------------------------------- 
  15     Method Drupal\serialization\Normalizer\MarkupNormalizer::normalize()  
         return type with generic class ArrayObject does not specify its       
         types: TKey, TValue                                                   
         🪪  missingType.generics                                              
 ------ ---------------------------------------------------------------------- 
 ------ -------------------------------------------------------------------- 
  Line   core/modules/serialization/src/Normalizer/NullNormalizer.php        
 ------ -------------------------------------------------------------------- 
  30     Method Drupal\serialization\Normalizer\NullNormalizer::normalize()  
         return type with generic class ArrayObject does not specify its     
         types: TKey, TValue                                                 
         🪪  missingType.generics                                            
 ------ -------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------- 
  Line   core/modules/serialization/src/Normalizer/PrimitiveDataNormalizer.php  
 ------ ----------------------------------------------------------------------- 
  18     Method                                                                 
         Drupal\serialization\Normalizer\PrimitiveDataNormalizer::normalize()   
         return type with generic class ArrayObject does not specify its        
         types: TKey, TValue                                                    
         🪪  missingType.generics                                               
 ------ ----------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------- 
  Line   core/modules/serialization/src/Normalizer/TimestampItemNormalizer.php  
 ------ ----------------------------------------------------------------------- 
  22     Method                                                                 
         Drupal\serialization\Normalizer\TimestampItemNormalizer::normalize()   
         return type with generic class ArrayObject does not specify its        
         types: TKey, TValue                                                    
         🪪  missingType.generics                                               
 ------ ----------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------- 
  Line   core/modules/serialization/src/Normalizer/TypedDataNormalizer.php  
 ------ ------------------------------------------------------------------- 
  15     Method                                                             
         Drupal\serialization\Normalizer\TypedDataNormalizer::normalize()   
         return type with generic class ArrayObject does not specify its    
         types: TKey, TValue                                                
         🪪  missingType.generics                                           
 ------ ------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------------------------------------------------- 
  Line   core/modules/serialization/tests/modules/field_normalization_test/src/Normalization/TextItemSillyNormalizer.php  
 ------ ----------------------------------------------------------------------------------------------------------------- 
  18     Method                                                                                                           
         Drupal\field_normalization_test\Normalization\TextItemSillyNormalizer::normalize()                               
         return type with generic class ArrayObject does not specify its                                                  
         types: TKey, TValue                                                                                              
         🪪  missingType.generics                                                                                         
 ------ ----------------------------------------------------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------------------------------------------------------- 
  Line   core/modules/serialization/tests/modules/test_datatype_boolean_emoji_normalizer/src/Normalizer/BooleanNormalizer.php  
 ------ ---------------------------------------------------------------------------------------------------------------------- 
  19     Method                                                                                                                
         Drupal\test_datatype_boolean_emoji_normalizer\Normalizer\BooleanNormalizer::normalize()                               
         return type with generic class ArrayObject does not specify its                                                       
         types: TKey, TValue                                                                                                   
         🪪  missingType.generics                                                                                              
 ------ ---------------------------------------------------------------------------------------------------------------------- 
 ------ --------------------------------------------------------------------------------------------------------------------------- 
  Line   core/modules/serialization/tests/modules/test_fieldtype_boolean_emoji_normalizer/src/Normalizer/BooleanItemNormalizer.php  
 ------ --------------------------------------------------------------------------------------------------------------------------- 
  19     Method                                                                                                                     
         Drupal\test_fieldtype_boolean_emoji_normalizer\Normalizer\BooleanItemNormalizer::normalize()                               
         return type with generic class ArrayObject does not specify its                                                            
         types: TKey, TValue                                                                                                        
         🪪  missingType.generics                                                                                                   
 ------ --------------------------------------------------------------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------------------------- 
  Line   core/modules/serialization/tests/serialization_test/src/SerializationTestNormalizer.php  
 ------ ----------------------------------------------------------------------------------------- 
  21     Method                                                                                   
         Drupal\serialization_test\SerializationTestNormalizer::normalize()                       
         return type with generic class ArrayObject does not specify its                          
         types: TKey, TValue                                                                      
         🪪  missingType.generics                                                                 
 ------ ----------------------------------------------------------------------------------------- 
 ------ --------------------------------------------------------------------------------------------------- 
  Line   core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php               
 ------ --------------------------------------------------------------------------------------------------- 
  158    Method                                                                                             
         Drupal\Tests\serialization\Unit\Normalizer\ContentEntityNormalizerTest::createMockFieldListItem()  
         return type with generic interface                                                                 
         Drupal\Core\Field\FieldItemListInterface does not specify its types:                               
         T                                                                                                  
         🪪  missingType.generics                                                                           
 ------ --------------------------------------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------------- 
  Line   core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php  
 ------ ----------------------------------------------------------------------------- 
  95     Method                                                                       
         Drupal\Tests\serialization\Unit\Normalizer\TestNormalizerBase::normalize()   
         return type with generic class ArrayObject does not specify its              
         types: TKey, TValue                                                          
         🪪  missingType.generics                                                     
 ------ ----------------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------------------------------------- 
  Line   core/modules/serialization/tests/src/Unit/Normalizer/TimestampItemNormalizerTest.php                   
 ------ ------------------------------------------------------------------------------------------------------- 
  176    Method                                                                                                 
         Drupal\Tests\serialization\Unit\Normalizer\TimestampItemNormalizerTest::createTimestampItemProphecy()  
         return type with generic class Prophecy\Prophecy\ObjectProphecy does                                   
         not specify its types: T                                                                               
         🪪  missingType.generics                                                                               
 ------ ------------------------------------------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php            
 ------ ---------------------------------------------------------------------- 
  154    Method                                                                
         Drupal\Tests\views\Unit\Plugin\query\SqlTest::setupEntityTypes()      
         return type with generic class Prophecy\Prophecy\ObjectProphecy does  
         not specify its types: T                                              
         🪪  missingType.generics                                              
 ------ ---------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------------------- 
  Line   core/tests/Drupal/Tests/Core/Cache/Context/IsFrontPathCacheContextTest.php        
 ------ ---------------------------------------------------------------------------------- 
  41     Method                                                                            
         Drupal\Tests\Core\Cache\Context\IsFrontPathCacheContextTest::createPathMatcher()  
         return type with generic class Prophecy\Prophecy\ObjectProphecy does              
         not specify its types: T                                                          
         🪪  missingType.generics                                                          
 ------ ---------------------------------------------------------------------------------- 
 ------ --------------------------------------------------------------------------- 
  Line   core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php  
 ------ --------------------------------------------------------------------------- 
  105    Method                                                                     
         Drupal\Tests\Core\Entity\EntityConstraintViolationListTest::setupEntity()  
         return type with generic interface                                         
         Drupal\Core\Field\FieldItemListInterface does not specify its types:       
         T                                                                          
         🪪  missingType.generics                                                   
 ------ --------------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------------------- 
  Line   core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php                     
 ------ ----------------------------------------------------------------------------------- 
  592    Method                                                                             
         Drupal\Tests\Core\Entity\EntityFieldManagerTest::setUpEntityWithFieldDefinition()  
         return type with generic interface                                                 
         Prophecy\Prophecy\ProphecyInterface does not specify its types: T                  
         🪪  missingType.generics                                                           
 ------ ----------------------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------- 
  Line   core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php                 
 ------ ----------------------------------------------------------------------- 
  250    Method Drupal\Tests\Core\Entity\EntityFormTest::setUpStorage() return  
         type with generic class Prophecy\Prophecy\ObjectProphecy does not      
         specify its types: T                                                   
         🪪  missingType.generics                                               
 ------ ----------------------------------------------------------------------- 
 ------ -------------------------------------------------------------------------------- 
  Line   core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php    
 ------ -------------------------------------------------------------------------------- 
  387    Method                                                                          
         Drupal\Tests\Core\Entity\Routing\DefaultHtmlRouteProviderTest::getEntityType()  
         return type with generic class Prophecy\Prophecy\ObjectProphecy does            
         not specify its types: T                                                        
         🪪  missingType.generics                                                        
 ------ -------------------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------------------- 
  Line   core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php                  
 ------ ---------------------------------------------------------------------------------- 
  1154   Method                                                                            
         Drupal\Tests\Core\Render\RendererPlaceholdersTest::setupThemeManagerForDetails()  
         return type with generic class                                                    
         PHPUnit\Framework\MockObject\Builder\InvocationMocker does not                    
         specify its types: TMockedClass                                                   
         🪪  missingType.generics                                                          
 ------ ---------------------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------ 
  Line   core/tests/PHPStan/tests/ComponentTestDoesNotExtendCoreTestTest.php     
 ------ ------------------------------------------------------------------------ 
  20     Method                                                                  
         Drupal\PHPStan\Tests\ComponentTestDoesNotExtendCoreTestTest::getRule()  
         return type with generic interface PHPStan\Rules\Rule does not          
         specify its types: TNodeType                                            
         🪪  missingType.generics                                                
 ------ ------------------------------------------------------------------------ 
ptmkenny’s picture

Issue summary: View changes
spokje’s picture

I agree, basically by default, with @mondrake.

Adding the current errors to the baseline would, as already stated by @mondrake, flag any new ones that pop up.
If we added them to be ignored by default with the parameters: ignoreErrors: "magic" new ones would also be ignored without warning us and thus not give us the chance to fix them, or at the very least give it an attempt.

So I'm on #TeamMondrake for adding them to the baseline.

mondrake’s picture

😀

ptmkenny’s picture

Ok, I went to add them to the baseline, but I couldn't figure out how to do that.

First, I tried using the baseline generated by GitLab CI, but the paths are different.

Then, based on this change record, I ran

vendor/bin/phpstan analyze --configuration=./core/phpstan.neon.dist --memory-limit=-1 --generate-baseline=core/.phpstan-baseline.php

which is the same code listed in the docs.

However, when I did this, the generated baseline has removed the comment for the identifier from all entries:

 $ignoreErrors = [];
 $ignoreErrors[] = [
-       // identifier: missingType.return
        'message' => '#^Method Drupal\\\\Composer\\\\Generator\\\\PackageGenerator\\:\\:generate\\(\\) has no return type specified\\.$#',
+       'identifier' => 'missingType.return',
        'count' => 1,
        'path' => __DIR__ . '/../composer/Generator/PackageGenerator.php',
 ];
 $ignoreErrors[] = [
-       // identifier: missingType.return
        'message' => '#^Method Drupal\\\\Composer\\\\Plugin\\\\ProjectMessage\\\\Message\\:\\:getText\\(\\) has no return type specified\\.$#',
+       'identifier' => 'missingType.return',
        'count' => 1,
        'path' => __DIR__ . '/../composer/Plugin/ProjectMessage/Message.php',
 ];

I don't understand why it is doing this and how I can generate a new baseline in the same format as has already been committed.

nicxvan’s picture

The comment has been removed but now it's part of the array.

That's actually better in my opinion cause now it's data.

ptmkenny’s picture

Issue summary: View changes
ptmkenny’s picture

Issue summary: View changes
ptmkenny’s picture

Status: Needs work » Needs review

Ok, tests are all passing and I believe I have addressed all feedback thus far, so I am setting back to "Needs review."

mondrake’s picture

Updated to PHPStan 2.0.4, removed ignore of missingType.generics and regenerated baseline

mondrake’s picture

Title: Bump PHPStan to version 2.0.0 » Bump PHPStan to version 2.0.4
spokje’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @ptmkenny and @mondrake: All changes make sense => RTBC,

  • longwave committed 22098897 on 11.x
    Issue #3486713 by ptmkenny, mondrake, spokje: Bump PHPStan to version 2....
longwave’s picture

Status: Reviewed & tested by the community » Fixed

I was a bit concerned that this is going to make backports tricky because of the format change in the baseline, but I looked at git history and we don't tend to change the baseline that often in backported issues anyway - mostly only in 11.x, so going forwards any patch that currently touches the baseline will need reroll now but then we should be good for the future.

Committed 2209889 and pushed to 11.x. Thanks!

longwave’s picture

Issue summary: View changes
Issue tags: +11.2.0 release notes

Status: Fixed » Closed (fixed)

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