Skip to content

Common prefix for phpdoc tags containing "new" (non-standard) phpdoc #7

Description

@TysonAndre

Many union types that are commonly used are not part of an official phpdoc standard or PSR-5, which (is being worked on by the php community and tooling authors but) has been a draft for years (?T, true, false, array<T>, array<K, T>, list<T>, T&U, etc.)

As a result, many tools don't support them - e.g. I've seen that phpstorm has an open ticket for array<..>: https://youtrack.jetbrains.com/issue/WI-6558

For users, it would be convenient to have two sets of tags:

  1. @x-param array<int, T> $x - to be used by all tools supporting non-standard phpdoc
  2. @param T[] $x, to be supported by tools only supporting standard phpdoc or a more limited subset.

The approach of reading tags meant for other analyzers/IDEs (e.g. a phpstan plugin reading tags for psalm) may cause problems or repetition - While it's usually useful, the tag may have been added for a given plugin, or to work around a false positive only affecting one analyzer/IDE.

Related to #3 and phpstan/phpstan#2223

My best idea is to use a prefix such as @x- everywhere (experimental). Other possibilities: @new-, etc, but it would only be useful if there were plans to support it in more than one tool.

cc @ondrejmirtes @muglug @staabm

e.g. @x-param, @x-return, @x-property, @x-method, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions