diff --git a/composer.json b/composer.json index c5103b64..8165a5e2 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,7 @@ "require-dev": { "doctrine/orm": "^2.7", "phpunit/phpunit": "~7.5", + "symfony/cache-contracts": "^1.0 || ^2.0", "symfony/console": "*", "symfony/messenger": "^4.2 || ^5.0", "symfony/security-guard": "^4.0 || ^5.0", diff --git a/src/Stubs/common/CacheInterface.stubphp b/src/Stubs/common/CacheInterface.stubphp new file mode 100644 index 00000000..ab725a81 --- /dev/null +++ b/src/Stubs/common/CacheInterface.stubphp @@ -0,0 +1,16 @@ + + + + + + + + + + + + """ + + Scenario: CacheInterface::get has the same return type as the passed callback + Given I have the following code + """ + get('key', function (CacheItemInterface $item, bool &$save): stdClass { + return new stdClass(); + }); + } + + """ + When I run Psalm + Then I see no errors