Hi,
When running profiling inside a single function, what’s the best way to end profiling when there are multiple return statements?
What does Yii do in this situation:
function runMeh(){
$key = 'MyProfileKey';
Yii::beginProfile($key);
if ( false )
return true;
some complex code
if (some new stuff matches)
return true;
else
lots of other returns and stuff
if ( I am true sometimes)
return true;
Yii::endProfile($key);
return false;
}
Would it end profiling cleverly on the return statement? or does it wait until all execution is complete as ?
I can’t decide which I would even want it to do tbh, as if I wanted to track something across lots of functions I wouldn’t want it to end on every return, but if it can see when the function is was initialized in returns, then I suppose that would be a clever way of doing it.