Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop the Attributes version #3

Open
DaveLiddament opened this issue Jan 8, 2021 · 0 comments
Open

Drop the Attributes version #3

DaveLiddament opened this issue Jan 8, 2021 · 0 comments

Comments

@DaveLiddament
Copy link
Owner

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]; 
}

..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant