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
Incorrect type for RuntimeException::getCode() #7672
Comments
I found these snippets: https://psalm.dev/r/512ac9662c<?php
try {
throw new PDOException();
} catch (RuntimeException $e) {
$code = $e->getCode();
/** @psalm-trace $code */;
}
|
I followed PHPStan on this https://phpstan.org/r/42089d28-dbaa-4b67-ac00-154372ce55a8 |
PDOException is a child of RuntimeException? :o What a mess :( ... |
I just opened an issue phpstan/phpstan#6651 and a PR phpstan/phpstan-src#1018 on PHPStan. I'll hope it will be reviewed quickly to be sure phpstan is going in the same direction. Do you want to make the fix on psalm @AndrolGenhald or should I ? |
You can go ahead, I'm in the middle of rewriting TryAnalyzer. |
I made #7673. But I would recommend to wait for a response from the phpstan-side in order to copy the behavior. |
https://psalm.dev/r/512ac9662c https://3v4l.org/RBCW0
@VincentLanglet re #7390
I suggest copy/pasting
psalm/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallReturnTypeFetcher.php
Line 99 in 06ce3ad
RuntimeException::class
check as well.Also, PDOException should return
int|string
(or maybe0|string
but I'm not sure): https://3v4l.org/9vu2uThe text was updated successfully, but these errors were encountered: