swagger-php icon indicating copy to clipboard operation
swagger-php copied to clipboard

Annotations Or Attributes?

Open sky93 opened this issue 1 year ago • 3 comments

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?

sky93 avatar Mar 10 '24 17:03 sky93

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: https://github.com/zircote/swagger-php/issues/1047

DerManoMann avatar Mar 10 '24 21:03 DerManoMann

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 :)

berkut1 avatar Apr 03 '24 23:04 berkut1