Skip to content

Commit 19ccb0f

Browse files
committed
Added CacheInterface test
1 parent 7f74d70 commit 19ccb0f

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

tests/Type/Symfony/ExtensionTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public function dataFileAsserts(): iterable
2020
}
2121

2222
yield from $this->gatherAssertTypes(__DIR__ . '/data/tree_builder.php');
23+
24+
if (interface_exists('\Symfony\Contracts\Cache\CacheInterface')) {
25+
yield from $this->gatherAssertTypes(__DIR__ . '/data/ExampleCacheInterface.php');
26+
}
27+
2328
yield from $this->gatherAssertTypes(__DIR__ . '/data/ExampleBaseCommand.php');
2429
yield from $this->gatherAssertTypes(__DIR__ . '/data/ExampleOptionCommand.php');
2530
yield from $this->gatherAssertTypes(__DIR__ . '/data/ExampleOptionLazyCommand.php');
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace PHPStan\Type\Symfony;
4+
5+
use Bar;
6+
use stdClass;
7+
use Symfony\Contracts\Cache\CacheInterface;
8+
use function PHPStan\Testing\assertType;
9+
10+
/** @var CacheInterface $cacheInterface */
11+
$cacheInterface = new stdClass();
12+
13+
$callbackCallable = static function (Bar $bar) {
14+
return $bar;
15+
};
16+
17+
assertType('Bar', $cacheInterface->get('cacheTest', $callbackCallable));

0 commit comments

Comments
 (0)