Closed mbabker closed 2 years ago
Fixes #2351
When running bin/console cache:clear -vvv, building the cache is failing hard with this error:
bin/console cache:clear -vvv
[ "exception" => Symfony\Component\ErrorHandler\Error\FatalError^ { -error: [ "type" => 64, "message" => "Declaration of FOS\RestBundle\Controller\PreSymfony6AbstractFOSRestController::getSubscribedServices() must be compatible with Symfony\Bundle\FrameworkBundle\Controller\AbstractController::getSubscribedServices(): array", "file" => "./vendor/friendsofsymfony/rest-bundle/Controller/PreSymfony6AbstractFOSRestController.php", "line" => 27 ] #message: "Compile Error: Declaration of FOS\RestBundle\Controller\PreSymfony6AbstractFOSRestController::getSubscribedServices() must be compatible with Symfony\Bundle\FrameworkBundle\Controller\AbstractController::getSubscribedServices(): array" #code: 0 #file: "./vendor/friendsofsymfony/rest-bundle/Controller/PreSymfony6AbstractFOSRestController.php" #line: 27 trace: { ./vendor/friendsofsymfony/rest-bundle/Controller/PreSymfony6AbstractFOSRestController.php:27 { …} ./vendor/symfony/error-handler/DebugClassLoader.php:287 { …} ./vendor/symfony/framework-bundle/CacheWarmer/AnnotationsCacheWarmer.php:84 { …} ./vendor/symfony/framework-bundle/CacheWarmer/AnnotationsCacheWarmer.php:84 { …} ./vendor/symfony/framework-bundle/CacheWarmer/AnnotationsCacheWarmer.php:62 { …} ./vendor/symfony/framework-bundle/CacheWarmer/AbstractPhpFileCacheWarmer.php:51 { …} ./vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php:99 { …} ./vendor/symfony/framework-bundle/Command/CacheClearCommand.php:141 { …} ./vendor/symfony/console/Command/Command.php:291 { …} ./vendor/symfony/console/Application.php:997 { …} ./vendor/symfony/framework-bundle/Console/Application.php:94 { …} ./vendor/symfony/console/Application.php:299 { …} ./vendor/symfony/framework-bundle/Console/Application.php:80 { …} ./vendor/symfony/console/Application.php:171 { …} ./vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:54 { …} ./vendor/autoload_runtime.php:29 { …} ./bin/console:11 { {main}^ › › require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; › } ./bin/console:0 { …} } } ]
The error is coming from the annotation cache warmer in the framework bundle, which is parsing this list of classes from this bundle:
13 => "FOS\RestBundle\Controller\AbstractFOSRestController" 14 => "FOS\RestBundle\Controller\Annotations\AbstractParam" 15 => "FOS\RestBundle\Controller\Annotations\AbstractScalarParam" 16 => "FOS\RestBundle\Controller\Annotations\Copy" 17 => "FOS\RestBundle\Controller\Annotations\Delete" 18 => "FOS\RestBundle\Controller\Annotations\FileParam" 19 => "FOS\RestBundle\Controller\Annotations\Get" 20 => "FOS\RestBundle\Controller\Annotations\Head" 21 => "FOS\RestBundle\Controller\Annotations\Link" 22 => "FOS\RestBundle\Controller\Annotations\Lock" 23 => "FOS\RestBundle\Controller\Annotations\Mkcol" 24 => "FOS\RestBundle\Controller\Annotations\Move" 25 => "FOS\RestBundle\Controller\Annotations\Options" 26 => "FOS\RestBundle\Controller\Annotations\ParamInterface" 27 => "FOS\RestBundle\Controller\Annotations\Patch" 28 => "FOS\RestBundle\Controller\Annotations\Post" 29 => "FOS\RestBundle\Controller\Annotations\PropFind" 30 => "FOS\RestBundle\Controller\Annotations\PropPatch" 31 => "FOS\RestBundle\Controller\Annotations\Put" 32 => "FOS\RestBundle\Controller\Annotations\QueryParam" 33 => "FOS\RestBundle\Controller\Annotations\RequestParam" 34 => "FOS\RestBundle\Controller\Annotations\Route" 35 => "FOS\RestBundle\Controller\Annotations\Unlink" 36 => "FOS\RestBundle\Controller\Annotations\Unlock" 37 => "FOS\RestBundle\Controller\Annotations\View" 38 => "FOS\RestBundle\Controller\ControllerTrait" 39 => "FOS\RestBundle\Controller\PostSymfony6AbstractFOSRestController" 40 => "FOS\RestBundle\Controller\PreSymfony6AbstractFOSRestController" ]
For some reason, both the compat classes are being included in the map. Inlining the compat classes into the AbstractFOSRestController.php file seems to get around the issue.
AbstractFOSRestController.php
thank you!
Fixes #2351
When running
bin/console cache:clear -vvv
, building the cache is failing hard with this error:The error is coming from the annotation cache warmer in the framework bundle, which is parsing this list of classes from this bundle:
For some reason, both the compat classes are being included in the map. Inlining the compat classes into the
AbstractFOSRestController.php
file seems to get around the issue.