Skip to content

Add multiple option to annotations #257

Description

@KittyGiraudel

Currently and from a strictly technical point of view, all annotations can appear multiple times on an item. That being said, it is wrong from a practical standpoint. Some annotations should not appear several times, for instance @type on variables, or @return on functions, only to name a few.

@FWeinb suggests we add a multiple boolean option on each annotation. This way, annotations would not always be arrays. They would be arrays if they allow multiple occurrences (i.e. multiple: true), else it would be a standalone value.

This would solve issue like:

{% if item.return %}
  {{ return[0].type }} {{ return[0].description }}
{% endif %}

... which is ugly as fuck.

This would trigger breaking changes, so it's either 2.0, or never (well, 3.0...).

Edit: this will lead to a new terminology "collection annotations" and "single annotations". I like it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions