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

Invalid return type for RuntimeException::getCode() #6651

Closed
VincentLanglet opened this issue Feb 14, 2022 · 1 comment · Fixed by phpstan/phpstan-src#1018
Closed

Invalid return type for RuntimeException::getCode() #6651

VincentLanglet opened this issue Feb 14, 2022 · 1 comment · Fixed by phpstan/phpstan-src#1018

Comments

@VincentLanglet
Copy link
Contributor

VincentLanglet commented Feb 14, 2022

Bug report

I recently implemented the same dynamic return type on psalm for exception::getCode() than it was implemented for phpstan

  • Exception::getCode(): int|string
  • PDOException::getCode(): string
  • OtherException::getCode(): int

But it seems like it's wrong as reported in the psalm issue vimeo/psalm#7672

Since PDOException extends RuntimeException, we have the following issue
https://phpstan.org/r/42089d28-dbaa-4b67-ac00-154372ce55a8
vs https://3v4l.org/RBCW0

Also not all PDOException::getCode() return a string
https://3v4l.org/VbUUa

@github-actions
Copy link

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 Mar 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant