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

Template usage on throws annotation #6098

Open
marcosh opened this issue Jul 15, 2021 · 3 comments
Open

Template usage on throws annotation #6098

marcosh opened this issue Jul 15, 2021 · 3 comments

Comments

@marcosh
Copy link
Contributor

marcosh commented Jul 15, 2021

It looks like that it is not currently possible to use templates while annotating @throws. See

https://psalm.dev/r/607d0aaa96

I think it would be reasonable to be able to use templates also when annotating thrown exceptions

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/607d0aaa96
<?php

/**
 * @template E of Exception
 * @param E $e
 * @throws E
 */
function foo(Exception $e): void {
	throw $e;
}
Psalm output (using commit 35b6a93):

ERROR: UndefinedDocblockClass - 6:12 - Docblock-defined class, interface or enum named E does not exist

@weirdan
Copy link
Collaborator

weirdan commented Jul 15, 2021

Duplicate of #3784

@weirdan weirdan marked this as a duplicate of #3784 Jul 15, 2021
@weirdan weirdan closed this as completed Jul 15, 2021
@orklah
Copy link
Collaborator

orklah commented Dec 22, 2021

I'm reopening this issue as #3784 has been closed after unrelated discussions and the use case here is legit.

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

No branches or pull requests

3 participants