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

Account for PDOException #3175

Merged
merged 1 commit into from
Apr 18, 2020
Merged

Account for PDOException #3175

merged 1 commit into from
Apr 18, 2020

Conversation

greg0ire
Copy link
Contributor

Probably for legacy reasons, PDOException::getCode() can return string (it's an
SQLSTATE code). Note that if you instantiate it yourself, you will get
an integer though.

I changed the signature of the Exception stub accordingly, and then
there were errors about incompatible signatures, so I had to change the
signature of Throwable too, which makes sense since a Throwable could be
a PDOException. The signature at
https://www.php.net/manual/en/throwable.getcode.php seems plain wrong,
and that same page of the docs warns about PDOException. Not sure what
are the plans for future versions of PHP.

Probably for legacy reasons, PDOException::getCode() can return string (it's an
SQLSTATE code). Note that if you instantiate it yourself, you will get
an integer though.

I changed the signature of the Exception stub accordingly, and then
there were errors about incompatible signatures, so I had to change the
signature of Throwable too, which makes sense since a Throwable could be
a PDOException. The signature at
https://www.php.net/manual/en/throwable.getcode.php seems plain wrong,
and that same page of the docs warns about PDOException. Not sure what
are the plans for future versions of PHP.
@greg0ire
Copy link
Contributor Author

greg0ire commented Apr 18, 2020

and then there were errors about incompatible signatures, so I had to change the signature of Throwable too

I rebased since then, and it no longer happens, what should I do? I think it makes sense since PDOException implements Throwable

@muglug muglug merged commit b47306a into vimeo:master Apr 18, 2020
@muglug
Copy link
Collaborator

muglug commented Apr 18, 2020

Yeah, this is correct – getCode doesn't have to return an int, sadly

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

Successfully merging this pull request may close these issues.

2 participants