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

Fix PDOException::getCode return type #1018

Merged
merged 2 commits into from Feb 23, 2022

Conversation

VincentLanglet
Copy link
Contributor

@VincentLanglet
Copy link
Contributor Author

Since a similar issue/PR is made on psalm for this change vimeo/psalm#7673, I'd like you opinion on this @ondrejmirtes, in order to move forward the PR on psalm and still have the same behavior with both static analyser.

If someone use both psalm and phpstan, with only one of the two static analyser changing the return type of getCode, it could create some conflict. Like one requiring a cast to int/string, and the other throwing an error because the cast is useless.

if ($pdoException->isSuperTypeOf($classType)->yes()) {
$types[] = new StringType();
$types[] = new UnionType([new IntegerType(), new StringType()]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather be if this was a benevolent union type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I made the change

@ondrejmirtes
Copy link
Member

Thank you.

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