We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.6.8
PHP 8.3
phpstan does not detect return value anymore properly
class Test { public function test() : string { return 'Test'; } } $test = \Mockery::mock(Test::class); $test->shouldReceive('test')->andReturn('Mocked'); echo $test->test();
No PHPStan errors
phpstan reports now following error: phpstan: Return type of call to static method Mockery::mock() contains unresolvable type.
No response
The text was updated successfully, but these errors were encountered:
/** * Static shortcut to Container::mock(). * * @template TMock * * @param array<class-string<TMock>|TMock> $args * * @return LegacyMockInterface&MockInterface&TMock */ public static function mock(...$args) { return self::getContainer()->mock(...$args); }
@ghostwriter I played around with phpdoc and with this I got PHPStan to dump correct type.
class Test { public function asd() : string { return 'Original'; } } $class = new Test(); $mock = \Mockery::mock(Test::class); $mock2 = \Mockery::mock($class); \PHPStan\dumpType($mock); \PHPStan\dumpType($mock2); $mock->shouldReceive('test')->andReturn('Mocked'); echo $mock->asd();
------ -------------------------------------------------- Line test.php ------ -------------------------------------------------- 48 Dumped type: Mockery\MockInterface&TEST_PHP\Test 49 Dumped type: Mockery\MockInterface&TEST_PHP\Test ------ --------------------------------------------------
Sorry, something went wrong.
Mockery::mock()
spy()
ghostwriter
Successfully merging a pull request may close this issue.
Mockery Version
1.6.8
PHP Version
PHP 8.3
Issue Description
phpstan does not detect return value anymore properly
Steps to Reproduce
Expected Behavior
No PHPStan errors
Actual Behavior
phpstan reports now following error: phpstan: Return type of call to static method Mockery::mock() contains unresolvable type.
Exception or Error
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: