From 9fb76499f9d975719a14a14f1fd7fbae3afab4bc Mon Sep 17 00:00:00 2001 From: Valentin Udaltsov Date: Tue, 18 Aug 2020 14:38:35 +0300 Subject: [PATCH] Added CacheInterface.stubphp from symfony contracts (#74) --- composer.json | 1 + src/Stubs/common/CacheInterface.stubphp | 16 ++++++++ .../acceptance/CacheInterface.feature | 37 +++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 src/Stubs/common/CacheInterface.stubphp create mode 100644 tests/acceptance/acceptance/CacheInterface.feature 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