-
Notifications
You must be signed in to change notification settings - Fork 0
Description
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
- PHPStorm does support some of these, though -
ArrayObject<K, V>,iterable<...>, and intersection types: https://blog.jetbrains.com/phpstorm/2018/09/phpstorm-2018-3-eap-183-2635-12/
For users, it would be convenient to have two sets of tags:
@x-param array<int, T> $x- to be used by all tools supporting non-standard phpdoc@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.