Closed
Description
Symfony version(s) affected
6.0.4
Description
AnnotationDirectoryLoader::load()
has a return type RouteCollection
, but it may return null
in some situations
Because it calls parent::load(), which is AnnotationFileLoader::load()
, which has return type ?RouteCollection
How to reproduce
- have an abstract class that extends
\Symfony\Bundle\FrameworkBundle\Controller\AbstractController
(e.g.abstract class AdminController extends AbstractController
) - have
config/routes/annotations.yaml
similar to:
controllers:
resource: '../../src/**/*Controller.php'
type: annotation
kernel:
resource: ../../src/Kernel.php
type: annotation
- upgrade from 5.4.4 to 6.0.4
Symfony\Component\Routing\Loader\AnnotationDirectoryLoader::load(): Return value must be of type Symfony\Component\Routing\RouteCollection, null returned
Possible Solution
Change the return type of AnnotationDirectoryLoader::load()
to ?RouteCollection
Additional Context
No response