neos / neos-development-collection

The unified repository containing the Neos core packages, used for Neos development.
https://www.neos.io/
GNU General Public License v3.0
260 stars 220 forks source link

TASK: Use correct @template-covariant tag for ProjectionFactoryInterface #5099

Closed mhsdesign closed 3 weeks ago

mhsdesign commented 1 month ago

See also https://github.com/neos/neos-development-collection/commit/329330e02b6b3aec50c1c3e041306f67ce59809d

See https://phpstan.org/blog/whats-up-with-template-covariant

Solves that

$projectionsFactory = new ProjectionsAndCatchUpHooksFactory();
$projectionsFactory->registerFactory(new DoctrineDbalContentGraphProjectionFactory($this->dbalClient), []);

yields when being used stand alone:

  172    Parameter #1 $factory of method Neos\ContentRepository\Core\Factory\ProjectionsAndCatchUpHooksFactory::registerFactory() expects                                                                                                                                                            
         Neos\ContentRepository\Core\Projection\ProjectionFactoryInterface<Neos\ContentRepository\Core\Projection\ProjectionInterface<Neos\ContentRepository\Core\Projection\ProjectionStateInterface>>, Neos\ContentGraph\DoctrineDbalAdapter\DoctrineDbalContentGraphProjectionFactory given.      
         💡 Template type T on class Neos\ContentRepository\Core\Projection\ProjectionFactoryInterface is not covariant. Learn more: https://phpstan.org/blog/whats-up-with-template-covariant                                                                                                       
         ✏️  file:///Users/marchenryschultz/Code/lab/standalone-content-repository/src/StandaloneContentRepositoryRegistry.php:172  

Upgrade instructions

Review instructions

Checklist