Skip to content
Permalink
Browse files

Fix #2558 - remove wedge clauses when they’re the only thing left

  • Loading branch information
muglug committed Jan 6, 2020
1 parent 4e85967 commit 4888ae67a6c0291e6f198eb44ab8716688d158dc
@@ -171,6 +171,14 @@ function ($c) use ($reconciled_expression_clauses) {
}
)
);

if (count($if_context->clauses) === 1
&& $if_context->clauses[0]->wedge
&& !$if_context->clauses[0]->possibilities
) {
$if_context->clauses = [];
$if_context->reconciled_expression_clauses = [];
}
}

// define this before we alter local claues after reconciliation
@@ -2483,6 +2483,21 @@ function foo($s, int $f = 1) : void {
) {}
}'
],
'assertNotFalseOnSameNamedVar' => [
'<?php
function foo(): int {
$a = rand(0, 1) ? 3 : false;
if ($a !== false && rand(0, 1)) {
$a = rand(0, 1) ? 3 : false;
if ($a !== false) {
return $a;
}
}
return 0;
}',
],
];
}

0 comments on commit 4888ae6

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