This is a feature request for a feature I don't think many are interested in. Still, worth thinking about.
class X {
/** @var ?int **/
private $x;
public function getX(): int {
$this->x = 5;
$this->modifyX();
return $this->x;
}
private function modifyX(): void {
$this->x = null;
}
}
Hack forbids the above code (though to see it you have to change the property type to one hack understands). Psalm, by default, allows the above code, but a config flag makes it follow Hack's behaviour.