-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Making the DBALException
implement Throwable
#2658
Conversation
@@ -45,13 +45,7 @@ class DriverException extends DBALException | |||
*/ | |||
public function __construct($message, \Doctrine\DBAL\Driver\DriverException $driverException) | |||
{ | |||
$exception = null; | |||
|
|||
if ($driverException instanceof \Exception) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes perfect sense because we are type hinting against an interface in the constructor and need to make sure that we really pass an exception to the parent constructor (IIRC).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deeky666 we should probably make DriverException
inherit from Throwable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds reasonable, yes. I guess it was just a sanity check here for PHP < 7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@svycka can you add the extends
on DriverException
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm I read it wrong :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ocramius but a bit don't udnerstand if I add interface DriverException extends \Throwable
It would still be not possible to pass parent::__construct($message, 0, $driverException);
because cosntructor expects \Exception
not \Throwable
ok it looks tat php does not allow implement \Throwable so closing |
@svycka patch looked correct: you can only implement |
FYI you should rebase so travis will correctly test your PR |
This change goes in as-is: patch is correct and we now enforce PHP 7.1 anyway. 👍 |
DBALException
implement Throwable
Doctrine\DBAL\DBALException
does not implement\Exception