-
-
Notifications
You must be signed in to change notification settings - Fork 934
Closed
phpstan/phpstan-src
#1842Description
Feature request
I still struggle with the following issue
#7667
When a library is relying a lot of __call method and @method there is no way to tell phpstan exceptions are thrown.
As explained in the issue,
Overriding the method with a stub is doing nothing since this is not a real method.
But if we have
/**
* @method int test()
*/
class Foo
{
/** @throws \Exception */
public function __call($name, $args)
{
if (rand(1, 10) > 5) {
throws \Exception()
}
}
}
try {
(new Foo())->test();
} catch (\Exception) {
}
Currently the catch is reported as a dead catch.
Would it be possible for phpstan to consider that the @throws tag of the __call method should be used for all the @method ?
I know @method is not a good practice. But when it's used by our vendor, we don't have a lot of solution...
Metadata
Metadata
Assignees
Labels
No labels