kphp
kphp copied to clipboard
Wrong `rl_type` for `new B` in `echo`
Minimal example
class B {
public function __toString(): void {
echo 1;
}
}
echo new B();
Expected
Сompile-time error about using the result of a void function.
Actual
At the moment we will give an error that the return type of __toString
is not a string
,
however, the void check will happen earlier and should be issued first, but it is not issued.
Apparently, this is due to an incorrect calculation of rl_type
, which is why the condition
is not match any in FixReturnsPass
.