-
-
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
Catch Throwable in Connection::transactional() #2390
Conversation
e30c77d
to
db06fce
Compare
} catch (\RuntimeException $expected) { | ||
$this->assertEquals(0, $this->_conn->getTransactionNestingLevel()); | ||
} | ||
} | ||
|
||
public function testTransactionalWithThrowable() | ||
{ | ||
if (version_compare(PHP_VERSION, '7.0', '<')) { |
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.
I'm not sure about the convention for skipping tests in older php versions. If this is not good I can change it.
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.
You can also use @requires php 7
in an annotation on this method
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 thanks, updated
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.
@fprochazka did you push? I still see the if
block
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.
Yeah I did, and it failed hard #2390 (diff)
db06fce
to
884d3b0
Compare
@@ -773,7 +774,7 @@ public function prepare($statement) | |||
{ | |||
try { | |||
$stmt = new Statement($statement, $this); | |||
} catch (\Exception $ex) { | |||
} catch (Exception $ex) { |
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.
I changed this because it was incosistent in this file (didn't look at the other files tho).
884d3b0
to
db06fce
Compare
This is completly PHP7 related, isn't it? We cannot add this before |
@deeky666 this is backward compliant too |
Reference implementation: https://github.com/zendframework/zend-stratigility/pull/49/files |
@fprochazka thanks! Responsibilities go out to @Ocramius :P |
I'm ready, should this go wrong |
Thank you :) |
I was considering adding it to other places, that use "catch-all", but none of them can invoke user-provided code, so it makes little sense adding the catch there.