diff --git a/hphp/hack/hhi/stdlib/builtins_math.hhi b/hphp/hack/hhi/stdlib/builtins_math.hhi index d2fb00ada15682..ee821d7b8dc850 100644 --- a/hphp/hack/hhi/stdlib/builtins_math.hhi +++ b/hphp/hack/hhi/stdlib/builtins_math.hhi @@ -32,7 +32,7 @@ const float M_LNPI; const float M_EULER; <<__PHPStdLib>> -function pi()[]: HH\FIXME\MISSING_RETURN_TYPE; +function pi()[]: float; <<__PHPStdLib>> function min( HH\FIXME\MISSING_PARAM_TYPE $value, @@ -48,9 +48,9 @@ function abs( HH\FIXME\MISSING_PARAM_TYPE $number, )[]: HH\FIXME\MISSING_RETURN_TYPE; <<__PHPStdLib>> -function is_finite(float $val)[]: HH\FIXME\MISSING_RETURN_TYPE; +function is_finite(float $val)[]: bool; <<__PHPStdLib>> -function is_infinite(float $val)[]: HH\FIXME\MISSING_RETURN_TYPE; +function is_infinite(float $val)[]: bool; <<__PHPStdLib>> function is_nan(float $val)[]: bool; <<__PHPStdLib>> @@ -97,51 +97,51 @@ function base_convert( )[]: HH\FIXME\MISSING_RETURN_TYPE; <<__PHPStdLib>> function pow( - HH\FIXME\MISSING_PARAM_TYPE $base, - HH\FIXME\MISSING_PARAM_TYPE $exp, -)[]: HH\FIXME\MISSING_RETURN_TYPE; + num $base, + num $exp, +)[]: dynamic; <<__PHPStdLib>> -function exp(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function exp(float $arg)[]: float; <<__PHPStdLib>> -function expm1(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function expm1(float $arg)[]: float; <<__PHPStdLib>> -function log10(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function log10(float $arg)[]: float; <<__PHPStdLib>> -function log1p(float $number)[]: HH\FIXME\MISSING_RETURN_TYPE; +function log1p(float $number)[]: float; <<__PHPStdLib>> -function log(float $arg, float $base = 0.0)[]: HH\FIXME\MISSING_RETURN_TYPE; +function log(float $arg, float $base = 0.0)[]: float; <<__PHPStdLib>> -function cos(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function cos(float $arg)[]: float; <<__PHPStdLib>> -function cosh(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function cosh(float $arg)[]: float; <<__PHPStdLib>> -function sin(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function sin(float $arg)[]: float; <<__PHPStdLib>> -function sinh(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function sinh(float $arg)[]: float; <<__PHPStdLib>> -function tan(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function tan(float $arg)[]: float; <<__PHPStdLib>> -function tanh(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function tanh(float $arg)[]: float; <<__PHPStdLib>> -function acos(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function acos(float $arg)[]: float; <<__PHPStdLib>> -function acosh(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function acosh(float $arg)[]: float; <<__PHPStdLib>> -function asin(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function asin(float $arg)[]: float; <<__PHPStdLib>> -function asinh(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function asinh(float $arg)[]: float; <<__PHPStdLib>> -function atan(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function atan(float $arg)[]: float; <<__PHPStdLib>> -function atanh(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function atanh(float $arg)[]: float; <<__PHPStdLib>> -function atan2(float $y, float $x)[]: HH\FIXME\MISSING_RETURN_TYPE; +function atan2(float $y, float $x)[]: float; <<__PHPStdLib>> -function hypot(float $x, float $y)[]: HH\FIXME\MISSING_RETURN_TYPE; +function hypot(float $x, float $y)[]: float; <<__PHPStdLib>> -function fmod(float $x, float $y)[]: HH\FIXME\MISSING_RETURN_TYPE; +function fmod(float $x, float $y)[]: float; <<__PHPStdLib>> -function sqrt(float $arg)[]: HH\FIXME\MISSING_RETURN_TYPE; +function sqrt(float $arg)[]: float; <<__PHPStdLib>> function getrandmax()[]: HH\FIXME\MISSING_RETURN_TYPE; <<__PHPStdLib>> diff --git a/hphp/hack/test/autocomplete/def_function.php.exp b/hphp/hack/test/autocomplete/def_function.php.exp index d0b409659edffd..31dc757cd56ad8 100644 --- a/hphp/hack/test/autocomplete/def_function.php.exp +++ b/hphp/hack/test/autocomplete/def_function.php.exp @@ -243,7 +243,7 @@ flush (function(): ~HH\FIXME\MISSING_RETURN_TYPE) fmod INSERT fmod(${1:\$x}, ${2:\$y}) - (function(float $x, float $y): ~HH\FIXME\MISSING_RETURN_TYPE) + (function(float $x, float $y): float) fnmatch INSERT fnmatch(${1:\$pattern}, ${2:\$filename}) (function(string $pattern, string $filename, int $flags = _): ~HH\FIXME\MISSING_RETURN_TYPE) diff --git a/hphp/hack/test/autocomplete/def_function_after_class.php.exp b/hphp/hack/test/autocomplete/def_function_after_class.php.exp index d0b409659edffd..31dc757cd56ad8 100644 --- a/hphp/hack/test/autocomplete/def_function_after_class.php.exp +++ b/hphp/hack/test/autocomplete/def_function_after_class.php.exp @@ -243,7 +243,7 @@ flush (function(): ~HH\FIXME\MISSING_RETURN_TYPE) fmod INSERT fmod(${1:\$x}, ${2:\$y}) - (function(float $x, float $y): ~HH\FIXME\MISSING_RETURN_TYPE) + (function(float $x, float $y): float) fnmatch INSERT fnmatch(${1:\$pattern}, ${2:\$filename}) (function(string $pattern, string $filename, int $flags = _): ~HH\FIXME\MISSING_RETURN_TYPE) diff --git a/hphp/hack/test/integration_ml/test_server_hover.ml b/hphp/hack/test/integration_ml/test_server_hover.ml index 906935ef07def5..405974be18a295 100644 --- a/hphp/hack/test/integration_ml/test_server_hover.ml +++ b/hphp/hack/test/integration_ml/test_server_hover.ml @@ -53,20 +53,20 @@ abstract class ClassMembers { // ^30:12 await ClassMembers::genLotsOfModifiers(); // ^32:11 ^32:25 - $this->calculateDistance(5, -6, 12, 1); + $this->calculateDistance(5.0, -6.0, 12.0, 1.0); // ^34:28 } /** Another method doc block */ public function calculateDistance( - int $originalPositionX, - int $finalPositionX, - int $originalPositionY, - int $finalPositionY, - ): int { + float $originalPositionX, + float $finalPositionX, + float $originalPositionY, + float $finalPositionY, + ): float { return sqrt( - pow($originalPositionX - $finalPositionX, 2) + - pow($originalPositionY - $finalPositionY, 2), + (float)pow($originalPositionX - $finalPositionX, 2) + + (float)pow($originalPositionY - $finalPositionY, 2), ); } } @@ -156,11 +156,11 @@ let class_members_cases = snippet = "// Defined in ClassMembers\n" ^ "public function calculateDistance(\n" - ^ " int $originalPositionX,\n" - ^ " int $finalPositionX,\n" - ^ " int $originalPositionY,\n" - ^ " int $finalPositionY\n" - ^ "): int"; + ^ " float $originalPositionX,\n" + ^ " float $finalPositionX,\n" + ^ " float $originalPositionY,\n" + ^ " float $finalPositionY\n" + ^ "): float"; addendum = ["Another method doc block"]; pos = pos_at (34, 12) (34, 28); }; diff --git a/hphp/runtime/ext/std/ext_std_math.php b/hphp/runtime/ext/std/ext_std_math.php index 88100c6c7058e0..198ccba8c55ef8 100644 --- a/hphp/runtime/ext/std/ext_std_math.php +++ b/hphp/runtime/ext/std/ext_std_math.php @@ -289,8 +289,8 @@ function base_convert(mixed $number, int $frombase, int $tobase)[]: mixed; * Returns base raised to the power of exp. Warning In PHP 4.0.6 and earlier * pow() always returned a float, and did not issue warnings. * - * @param mixed $base - The base to use - * @param mixed $exp - The exponent + * @param num $base - The base to use + * @param num $exp - The exponent * * @return mixed - base raised to the power of exp. If the result can be * represented as integer it will be returned as type integer, else it will be @@ -299,7 +299,7 @@ function base_convert(mixed $number, int $frombase, int $tobase)[]: mixed; * */ <<__IsFoldable, __Native>> -function pow(mixed $base, mixed $exp)[]: mixed; +function pow(num $base, num $exp)[]: mixed; /** * Returns e raised to the power of arg. 'e' is the base of the natural