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

Idea: Add a way to indicate that a template type is a subtype of another type #1666

Open
TysonAndre opened this issue May 6, 2018 · 0 comments

Comments

@TysonAndre
Copy link
Member

commented May 6, 2018

E.g. should be able to indicate that something is a subclass/subtype of another type.

If the below example is used (e.g. in phpdoc) without template annotations, it should still be able to infer that getFirstElement returns object

(The constructor should warn about non-objects)

/**
 * @template T extends object
 */
class MyCollection {
    // ...
    
    /** @return T */
    public function getFirstElement() {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.