Skip to content

Commit

Permalink
Base the compat layer on whether the return type is on the controller…
Browse files Browse the repository at this point in the history
…, not the services contract
  • Loading branch information
mbabker committed Nov 21, 2021
1 parent c74bb01 commit 322efbb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Controller/AbstractFOSRestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
namespace FOS\RestBundle\Controller;

use FOS\RestBundle\View\ViewHandlerInterface;
use Symfony\Contracts\Service\ServiceSubscriberInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

$ref = new \ReflectionMethod(ServiceSubscriberInterface::class, 'getSubscribedServices');
$ref = new \ReflectionMethod(AbstractController::class, 'getSubscribedServices');

// Has the ServiceSubscriberInterface a return type hint
// Does the AbstractController::getSubscribedServices() method have a return type hint?
if (null !== $ref->getReturnType()) {
class_alias(PostSymfony6AbstractFOSRestController::class, 'FOS\RestBundle\Controller\BaseAbstractFOSRestController');
} else {
Expand Down

0 comments on commit 322efbb

Please sign in to comment.