Skip to content
Permalink
Browse files

Add possibly defined vars in binary op analysis

  • Loading branch information
muglug committed Dec 11, 2019
1 parent e476eed commit d2b99cbe77ea1683bdf61806980f42556bdc2ead
@@ -249,6 +249,11 @@ function ($c) {
)
);

$if_context->vars_possibly_in_scope = array_merge(
$context->vars_possibly_in_scope,
$if_context->vars_possibly_in_scope
);

$if_context->updateChecks($context);
} else {
$context->vars_in_scope = $left_context->vars_in_scope;
@@ -2222,6 +2222,22 @@ function gimmeAString(?string $v): string {
return $v;
}'
],
'possiblyDefinedVarInAssertion' => [
'<?php
class A {
public function test() : bool { return true; }
}
function getMaybeA() : ?A { return rand(0, 1) ? new A : null; }
function foo() : void {
if (rand(0, 10) && ($a = getMaybeA()) && !$a->test()) {
return;
}
echo isset($a);
}'
],
];
}

0 comments on commit d2b99cb

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