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

Annotations Or Attributes? #1555

Open
sky93 opened this issue Mar 10, 2024 · 3 comments
Open

Annotations Or Attributes? #1555

sky93 opened this issue Mar 10, 2024 · 3 comments
Labels

Comments

@sky93
Copy link

sky93 commented Mar 10, 2024

Hello,

I want to know that is it recommended to use Annotations or Attributes for docs? Which one is better? I've used annotations for years. Is it possible to convert to attributes somehow?

@DerManoMann
Copy link
Collaborator

Generally I'd say the way forward is Attributes - it's part of PHP itself, gives you typing and and a lot more flexibility.

Also, annotations are slowly moving towards being deprecated. A lot pf projects have started making annotations optional, for example.

In terms of conversion - have a look here: #1047

@berkut1
Copy link

berkut1 commented Apr 3, 2024

The most useful thing about attributes is that IDEs fully support autocompletion with them; you can create docs rules without documentation. With annotations, it was a pain, especially when code highlighting worked incorrectly with annotations :)

@DerManoMann DerManoMann pinned this issue Jul 16, 2024
@xinframe
Copy link

Attributes are predominantly utilized in business logic, akin to attribute-based routing. In a certain sense, documentation can be considered optional, provided that it does not interfere with the program's functionality. When employing attributes, one must take into account the associated documentation during class reflection. However, some projects may not necessitate comprehensive documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants