Skip to content
Permalink
Browse files

Fix more try/catch stuff

  • Loading branch information
muglug committed Nov 12, 2019
1 parent 51557c4 commit b1aae0d1a5a11908e0e5f9eb6795ab7bb3f43577
@@ -372,12 +372,6 @@ function ($fq_catch_class) use ($codebase) {
);
if ($context->collect_references && $catch_actions[$i] !== [ScopeAnalyzer::ACTION_END]) {
foreach ($context->unreferenced_vars as $var_id => $_) {
if (!isset($catch_context->unreferenced_vars[$var_id])) {
unset($context->unreferenced_vars[$var_id]);
}
}
$newly_unreferenced_vars = array_merge(
$newly_unreferenced_vars,
array_diff_key(
@@ -1223,7 +1223,7 @@ function makeResultSet(callable $callback)
return $callback();
}
makeResultSet([A::class, "returnsObjectOrNull"]);',
makeResultSet([B::class, "returnsObjectOrNull"]);',
'error_message' => 'InvalidArgument',
],
'templateInvokeArg' => [
@@ -1232,6 +1232,25 @@ function foo() : void {
}
}'
],
'usedVarInCatchAndAfter' => [
'<?php
function foo() : void {
if (rand(0, 1)) {
throw new \Exception("bad");
}
}
$a = null;
try {
foo();
$a = "hello";
} catch (\Exception $e) {
echo $a;
}
echo $a;'
],
];
}

0 comments on commit b1aae0d

Please sign in to comment.
You can’t perform that action at this time.