After T226266: Create a phan plugin to handle the Assert library landed in wikimedia/assert 0.5.0, we got all sorts of new false positives in the Parsoid code base, where we use code like:
switch($c) { case 1: ....; case 2: ....; default: Assert::invariant(false, "Should never happen!"); }
to indicate unreachable code paths.
After we upgrade to wikimedia/assert 0.5.0 each one of these triggers:
src/Utils/PHPUtils.php:227 PhanImpossibleCondition Impossible attempt to cast false of type false to truthy
Yeah, that's the point!
Perhaps we need a new Assert::unreachable('should never happen') type call.
EDIT: New recommendation is for this to be written as throw new UnreachableException("should never happen") with UnreachableException defined in the wikimedia\assert package.
See T240141: Phan should handle always-throw-function like ApiBase::dieWithError better as well.