Twig 4 compatilibity
Is there any downside to adding a return type of array to getFilters()?
Script cache:clear returned with error code 255
!! PHP Fatal error: Declaration of Doctrine\Bundle\DoctrineBundle\Twig\DoctrineExtension::getFilters() must be compatible with Twig\Extension\AbstractExtension::getFilters(): array in /home/tac/sites/pokemon/vendor/doctrine/doctrine-bundle/src/Twig/DoctrineExtension.php on line 44
!! Symfony\Component\ErrorHandler\Error\FatalError {#5861
!! #message: "Compile Error: Declaration of Doctrine\Bundle\DoctrineBundle\Twig\DoctrineExtension::getFilters() must be compatible with Twig\Extension\AbstractExtension::getFilters(): array"
!! #code: 0
!! #file: "./vendor/doctrine/doctrine-bundle/src/Twig/DoctrineExtension.php"
!! #line: 44
!! -error: array:4 [
!! "type" => 64
!! "message" => "Declaration of Doctrine\Bundle\DoctrineBundle\Twig\DoctrineExtension::getFilters() must be compatible with Twig\Extension\AbstractExtension::getFilters(): array"
!! "file" => "/home/tac/sites/pokemon/vendor/doctrine/doctrine-bundle/src/Twig/DoctrineExtension.php"
!! "line" => 44
!! ]
!! }
!!
/vendor/doctrine/doctrine-bundle/src/Twig/DoctrineExtension.php
Or is this something that will need to wait for a point release?
We can add it in patch release. However, is that the only change needed for twig 4 support?
Any downside to adding it now? I've started to test Symfony 7.3 and twig 4, and got stuck here. I assume there's a solution, but is there a downside to simply adding it now? Like breaking some old version of php?
Yes it's potentially BC breaking in case somebody extends that class. Hence it will be added together with Twig 4 support, not separately. If it's the only thing needed for Twig 4 support, I'm fine with having it in patch release, otherwise no.
And as expected, it's not the only change required https://github.com/doctrine/DoctrineBundle/blob/4c59dbca6394ef060d0423c429380eb0a4cae391/composer.json#L76
@ostrolucky isn't this a conflict rule forbidding old verisons of Twig ?
I stand corrected. So again, is this the only change required? Tests currently can't really coexist with twig 4, because symfony dependencies are blocking twig 4.