Skip to main content


Can anybody write a #phpunit test asserting we get 2 exceptions here: github.com/doctrine/orm/pull/1… ?
This entry was edited (1 year ago)
in reply to Hypolite Petovan

@hypolite in this case the `finally` block does not need to alter the return value of the function so no, it doesn't need to have such a statement. We're you suggesting it would read better if the existing `return` statement would be moved there or something?
in reply to greg0ire

@greg0ire :doctrine: I was confused about what finally does, I've not used it in a while. And if I'm confused, then I probably won't be the only one. Is the return value expected to be true if there's an exception thrown? Intuitively I expect the finally block to return false.
in reply to Hypolite Petovan

@hypolite if there's an exception, there is no return value because it blows up before the function even gets a chance to return. A piece of code that would be equivalent IMO would be a try catch inside a catch that would attach one exception to the other (or rather, one chain of exceptions to the other) before rethrowing.
in reply to greg0ire

@greg0ire :doctrine: Right, I see what you mean now, without a catch block it will still interrupt the flow when an exception is thrown. Phew!