-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace annotations with attributes in code examples #16877
Comments
After thinking about this, I propose the following:
Practical example: Routing: use annotations + attributes in Possible exceptions: Doctrine annotations are quickly disappearing because even the Maker bundle now only generates attributes, so maybe we should only show attributes in all pages. What do you think? Ping @symfony/team-symfony-docs |
I would use PHP attributes everywhere. |
I agree with Fabien. |
I would say:
This way, people can have a look at the LTS docs if they are still using annotations, and we don't have the maintenance burden going forward |
I agree with @wouterj |
OK, so it seems that there's a consensus around Fabien's idea and Wouter's implementation. Let's do that 🙌 |
Yup - Wouter wins again! |
…nd Controller (alexandre-daubois) This PR was submitted for the 6.1 branch but it was merged into the 6.0 branch instead. Discussion ---------- Replace annotations by attributes in Serializer and Controller Resolves symfony#16877 Commits ------- f464d5f Replace annotations by attributes in Serializer and Controller
Maybe pinning this issue would give it visibility and encourage people to update the different pages? |
…annotation configuration block (ker0x) This PR was merged into the 6.0 branch. Discussion ---------- Replace Route annotations with attributes, remove Route annotation configuration block As discussed in #16877, this PR replaces all ``@Route`` annotations with `#[Route]` attributes. It also remove Route annotation configuration block. I only replaced the ``@Route`` annotations to simplify the review and get some initial feedback. Depending on them, I will adjust the changes and submit other PR to replace the other type of annotations if it's ok for you! Commits ------- 695332c Replace Route annotations with attributes, remove Route annotation configuration block
Currently, the documentation is composed of a mix between annotations and attributes in the different code examples.
For example, the Mercure documentation uses Doctrine attributes while the Serializer documentation use Annotations.
Same goes for the Controller documentation and the Mailer documentation with the
Route
annotation/attribute!The support for annotation has been recently dropped in the maker bundle for Entities and the
Route
attribute is already use when generating Controller,So, in order to be consistent everywhere, wouldn't it be interesting to replace annotations with attributes when possible?
The text was updated successfully, but these errors were encountered: