<?php
class FloatReturnTypeCoercion {
    private function value(int $n): float {
        if ($n <= 1) {
            return $n;
        }
        return $n + 0.5;
    }

    public function run() {
        $result = $this->value(0);
        $expected = (float)0;
        if ($result !== $expected) {
            throw new \UnexpectedValueException("got {$result}, expected {$expected}", 1);
        }
        echo "OK\n";
    }
}
$o = new FloatReturnTypeCoercion();
$o->run();
