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 707 forks source link

Fix compatibility of Route annotations with symfony >= 5.3 #2312

Closed W0rma closed 2 years ago

W0rma commented 3 years ago

Constructing Route annotations using named arguments was added in symfony 5.2 (https://github.com/symfony/symfony/pull/40266)

Closes https://github.com/FriendsOfSymfony/FOSRestBundle/issues/2311

deluxetom commented 3 years ago

Can this be merged? it creates a lot of deprecation warnings in SF 5.3

h4rvk4 commented 2 years ago

+1

W0rma commented 2 years ago

Adding support for PHP8 attributes in Route annotations should be quite simple after this PR got merged.

@xabbuh Would you prefer a separate PR for adding attributes support or should I add it to this PR?

xabbuh commented 2 years ago

please create an additional PR for that

Th3Mouk commented 2 years ago

Hello @W0rma ! I made a similar implementation on a fork and if you want to keep the full compatibility of old annotations from <5.2 you need to add this. Because it's currently managed by SF5, but no longer in SF6. So @Post("/articles", name="post_articles") will not work on SF6 without this little patch

W0rma commented 2 years ago

@Th3Mouk Thank you for the hint regarding compatibility with symfony 6.

My approach is a bit different since I want to enable native PHP 8 attributes afterwards. Nevertheless I now added an additional check which should ensure compatibility with symfony 6.

GuilhemN commented 2 years ago

Thank you @W0rma!