Skip to content
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

Closed
ker0x opened this issue Jun 15, 2022 · 8 comments
Closed

Replace annotations with attributes in code examples #16877

ker0x opened this issue Jun 15, 2022 · 8 comments

Comments

@ker0x
Copy link
Contributor

ker0x commented Jun 15, 2022

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?

@javiereguiluz
Copy link
Member

After thinking about this, I propose the following:

  • Let's keep showing both annotations and attributes in the main article about some topic which uses both
  • Let's use only attributes in the other articles not related to that topic

Practical example:

Routing: use annotations + attributes in routing.rst article ... but only use attributes in all the other docs whenever we want to display the route of a controller

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

@fabpot
Copy link
Member

fabpot commented Aug 7, 2022

I would use PHP attributes everywhere.

@xabbuh
Copy link
Member

xabbuh commented Aug 8, 2022

I agree with Fabien.

@wouterj
Copy link
Member

wouterj commented Aug 8, 2022

I would say:

  • Show both on the 5.4 docs
  • Only use attributes in 6.0+

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

@OskarStark
Copy link
Contributor

I agree with @wouterj

@javiereguiluz
Copy link
Member

OK, so it seems that there's a consensus around Fabien's idea and Wouter's implementation. Let's do that 🙌

@weaverryan
Copy link
Member

Yup - Wouter wins again!

javiereguiluz added a commit to javiereguiluz/symfony-docs that referenced this issue Aug 9, 2022
…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
@alexislefebvre
Copy link
Contributor

Maybe pinning this issue would give it visibility and encourage people to update the different pages?

javiereguiluz added a commit that referenced this issue Aug 10, 2022
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants