You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, we just noticed some strange failing tests after upgrading to 1.10.0. We isolated the problem to this test case.
require__DIR__ . '/vendor/autoload.php';
class A {
publicfunctioncalc(callable$callable): int
{
return0;
}
}
$prophet = new \Prophecy\Prophet();
$callable = function() {};
$a = $prophet->prophesize(A::class);
$a->calc($callable)->willReturn(1);
var_dump($a->reveal()->calc($callable));
with 1.9.0, the output is int(1)
with 1.10.0 there's a fatal error
PHP Fatal error: Uncaught TypeError: Return value of Double\A\P1::calc() must be of the type int, null returned in /Users/albert/Projects/backend-app/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php(49) : eval()'d code:6
Stack trace:
#0 /Users/albert/Projects/backend-app/test_prophecy.php(18): Double\A\P1->calc(Object(Closure))
#1 {main}
thrown in /Users/albert/Projects/backend-app/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php(49) : eval()'d code on line 6
Fatal error: Uncaught TypeError: Return value of Double\A\P1::calc() must be of the type int, null returned in /Users/albert/Projects/backend-app/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php(49) : eval()'d code:6
Stack trace:
#0 /Users/albert/Projects/backend-app/test_prophecy.php(18): Double\A\P1->calc(Object(Closure))
#1 {main}
thrown in /Users/albert/Projects/backend-app/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php(49) : eval()'d code on line 6
we're using PHP 7.3.13.
The problem seems to be related somehow to the callable, it does not happen if the function argument is a scalar or an object. Any ideas? Thx!!
The text was updated successfully, but these errors were encountered:
Hi, we just noticed some strange failing tests after upgrading to 1.10.0. We isolated the problem to this test case.
with 1.9.0, the output is
int(1)
with 1.10.0 there's a fatal error
we're using PHP 7.3.13.
The problem seems to be related somehow to the callable, it does not happen if the function argument is a scalar or an object. Any ideas? Thx!!
The text was updated successfully, but these errors were encountered: