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

Exceptions thrown are not detected on __invoke method #6233

Closed
sidux opened this issue Dec 24, 2021 · 6 comments
Closed

Exceptions thrown are not detected on __invoke method #6233

sidux opened this issue Dec 24, 2021 · 6 comments
Labels
Milestone

Comments

@sidux
Copy link

sidux commented Dec 24, 2021

Bug report

Code snippet that reproduces the problem

TestClass {
	/**
	 * @throws \Exception
	**/
	public function __invoke() {}
}

class Container {

	/**
	 * @throws \Exception
	**/
	public function test() {
		(new TestClass())()
	}
}

gets the error : Method Container::test() has \Exception in PHPDoc @throws tag but it's not thrown.

Exceptions are not checked in phpstan.org so could not reproduce there.

Expected output

No Error

@mergeable
Copy link

mergeable bot commented Dec 24, 2021

This bug report is missing a link to reproduction on phpstan.org.

It will most likely be closed after manual review.

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Feb 1, 2022
@PHLAK
Copy link

PHLAK commented Feb 10, 2022

I'm running into the same issue locally but I'm unable to reproduce it on phpstan.org.

@VincentLanglet
Copy link
Contributor

I'd like to try solving this issue @ondrejmirtes, any recommendations ?

@ondrejmirtes
Copy link
Member

@ondrejmirtes
Copy link
Member

ondrejmirtes commented Oct 2, 2023

Fixed: phpstan/phpstan-src#2502

Copy link

github-actions bot commented Nov 3, 2023

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants