FriendsOfSymfony / FOSRestBundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony
http://symfony.com/doc/master/bundles/FOSRestBundle/index.html
MIT License
2.79k stars 704 forks source link

Fixed bug for PHP 8 #2307

Closed Victor-Truhanovich closed 3 years ago

Victor-Truhanovich commented 3 years ago

Attempted to call an undefined method named "isBuiltin" of class "ReflectionUnionType".

xabbuh commented 3 years ago

Can you please add a test case that would fail without this change?

Victor-Truhanovich commented 3 years ago
/**
 * @Rest\Route("accounts")
 */
class AccountController extends AbstractFOSRestController implements ApiControllerInterface
{
    /**
     * @Rest\Get("/{id}", requirements={"id"="\d+"})
     *
     * @param Account|EntityInterface $account
     *
     * @return View
     */
    public function read(Account|EntityInterface $account): View
    {
        return $this->accountResponseManager->create($account);
    }
}
Victor-Truhanovich commented 3 years ago

Can you please add a test case that would fail without this change?

Sorry, I added tests for my code, but I never got an answer from you

xabbuh commented 3 years ago

Thank you @Viktor-Truhanovich.