diff --git a/src/Type/ResourceType.php b/src/Type/ResourceType.php index 3e83e3d819..01e7fe86e0 100644 --- a/src/Type/ResourceType.php +++ b/src/Type/ResourceType.php @@ -72,7 +72,7 @@ public function toInteger(): Type public function toFloat(): Type { - return new ErrorType(); + return new FloatType(); } public function toArray(): Type diff --git a/tests/PHPStan/Rules/Cast/InvalidCastRuleTest.php b/tests/PHPStan/Rules/Cast/InvalidCastRuleTest.php index cad88fb000..3bbc8521a5 100644 --- a/tests/PHPStan/Rules/Cast/InvalidCastRuleTest.php +++ b/tests/PHPStan/Rules/Cast/InvalidCastRuleTest.php @@ -43,15 +43,15 @@ public function testRule(): void ], [ 'Cannot cast object to string.', - 35, + 36, ], [ 'Cannot cast Test\\Foo to string.', - 41, + 42, ], [ 'Cannot cast array|float|int to string.', - 48, + 49, ], ]); } diff --git a/tests/PHPStan/Rules/Cast/data/invalid-cast.php b/tests/PHPStan/Rules/Cast/data/invalid-cast.php index 4c48e6acfa..061f41342f 100644 --- a/tests/PHPStan/Rules/Cast/data/invalid-cast.php +++ b/tests/PHPStan/Rules/Cast/data/invalid-cast.php @@ -25,6 +25,7 @@ function ( (string) fopen('php://memory', 'r'); (int) fopen('php://memory', 'r'); + (float) fopen('php://memory', 'r'); }; function (