php-generics-standard
php-generics-standard copied to clipboard
Drop the Attributes version
Reasons for dropping the proposed Attributes version of annotating code (see example below):
- Not supported and a perfectly acceptable alternative exists (docblocks)
- Would require static analysis tool authors to do extra work to support it.
- Is it actually better than docblocks?
use StaticAnalysis\Generics\v1\Template;
use StaticAnalysis\Generics\v1\Type;
#[Template("T")]
#[Type("array<int,T>")] // This is documenting the return type
function asArray(
#[Type("T")] $value,
) {
return [$value];
}
..