<?php function withAssignment(float $f): float { if ($f === 0.0) { $f = 0.0; // reported as assign.redundant } return $f; } function withoutAssignment(float $f): float { if ($f === 0.0) { } return $f; } function g(): float { $x = -0.0; $x = 0.0; // reported as assign.redundant return $x; } foreach (['withAssignment', 'withoutAssignment', 'g'] as $fn) { $v = $fn === 'g' ? g() : $fn(-0.0); printf( "%-18s (string): %-3s var_export: %-5s json_encode: %-3s fdiv(1, v): %s\n", $fn, (string) $v, var_export($v, true), json_encode($v), var_export(fdiv(1, $v), true), ); }
You have javascript disabled. You will not be able to edit any code.