Throw points (work in progress)#481
Conversation
|
Hi, I like starting with a minimal approach so 👍 on that! I'll review it once I get to chance, if it's a cohesive set of changes please don't add anything to it meanwhile. As for the test you can't figure out - for functions you need to require_once the file in gatherAssertTypes. That's why you've put the assert code in an anonymous function below so that's good. Alternatively you can test classes + calling methods which thanks to autoloading doesn't require such workarounds. Don't forget to call composer dump-autoload once you add the class. |
That works, thank you!
I'll need to do both since |
|
It would be great if all the tests passed before I review this. Thank you. |
|
But the general direction looks promising :) |
|
Please use rebase instead of merge commits, I want to keep the history linear. |
1e7ed2b to
a59d356
Compare
|
That should be green + no merge commits @ondrejmirtes. Still to do:
I had to make some adjustments to the resolution of |
a59d356 to
87ebe48
Compare
87ebe48 to
996fd0e
Compare
|
Nice! Looks like we're getting there, do you want me to add the test coverage for the nodes you implemented as well? |
|
@rainbow-alex It's fine like this, I'm almost finished locally :) |
|
@rainbow-alex This commit (e0182ce) is the main thing that was missing - the actual connection between throw points and specific catch blocks :) |
|
Thank you! |
As discussed in #472 I've begun implementing the 'throw points' logic in NodeScopeResolver. As you suspected @ondrejmirtes
assertVariableCertaintydoes the trick.So far I've only implemented throw points at a statement level, so all expressions are still behaving as if they are nothrow, only an explicit
throwstatement creates a point. I just started extending the implementation to the expression level and I am running into an issue. I am trying to get this test to pass:But I can't seem to get
throws()to resolve... when processing theFuncCallnode,$functionReflectionis always null. I'm not sure how get it to work, I hope I won't have to go messing around inTestCase::createBroker...