phpDocumentor icon indicating copy to clipboard operation
phpDocumentor copied to clipboard

Which tag to use when using constructor property promotion

Open mumbomedia opened this issue 1 year ago • 0 comments

Since PHP 8.0 it is possible to use the promotion constructor property. see https://php.watch/versions/8.0/constructor-property-promotion.

This leads me to consider which tag I should use to document the promoted properties. @param, because it is a parameter of the constructor method? But then phpdocumentor will not indicate that it is also a class property or @var because it is also a class property Then the parameter part is missing.

or at worst both tags, which would lead to duplicate comments just for the sake of completeness? You can't be serious.

So if there is no suitable way to document the promotion of constructor properties with just one tag, then I think introducing a separate tag for this would be a benefit for all developers using this new feature. That way the code doesn't have to contain more comments than necessary.

mumbomedia avatar Dec 12 '23 10:12 mumbomedia