We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2e25964 commit 96ee630Copy full SHA for 96ee630
extension.neon
@@ -12,6 +12,7 @@ parameters:
12
console_application_loader: null
13
consoleApplicationLoader: null
14
stubFiles:
15
+ - stubs/Psr/Cache/CacheItemInterface.stub
16
- stubs/Symfony/Bundle/FrameworkBundle/KernelBrowser.stub
17
- stubs/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.stub
18
- stubs/Symfony/Bundle/FrameworkBundle/Test/TestContainer.stub
@@ -51,6 +52,9 @@ parameters:
51
52
- stubs/Symfony/Component/Validator/Constraint.stub
53
- stubs/Symfony/Component/Validator/ConstraintViolationInterface.stub
54
- stubs/Symfony/Component/Validator/ConstraintViolationListInterface.stub
55
+ - stubs/Symfony/Contracts/Cache/CacheInterface.stub
56
+ - stubs/Symfony/Contracts/Cache/CallbackInterface.stub
57
+ - stubs/Symfony/Contracts/Cache/ItemInterface.stub
58
- stubs/Twig/Node/Node.stub
59
60
parametersSchema:
stubs/Psr/Cache/CacheItemInterface.stub
@@ -0,0 +1,7 @@
1
+<?php
2
+
3
+namespace Psr\Cache;
4
5
+interface CacheItemInterface
6
+{
7
+}
stubs/Symfony/Contracts/Cache/CacheInterface.stub
@@ -0,0 +1,15 @@
+namespace Symfony\Contracts\Cache;
+interface CacheInterface
+ /**
8
+ * @template T
9
+ *
10
+ * @param \Symfony\Contracts\Cache\CallbackInterface<T>|callable(\Symfony\Contracts\Cache\ItemInterface): T $callback
11
+ * @param array<mixed> $metadata
+ * @return T
+ */
+ public function get(string $key, callable $callback, float $beta = null, array &$metadata = null);
stubs/Symfony/Contracts/Cache/CallbackInterface.stub
@@ -0,0 +1,16 @@
+use Psr\Cache\CacheItemInterface;
+/**
+interface CallbackInterface
+ public function __invoke(CacheItemInterface $item, bool &$save);
stubs/Symfony/Contracts/Cache/ItemInterface.stub
@@ -0,0 +1,9 @@
+interface ItemInterface extends CacheItemInterface
tests/Type/Symfony/ExtensionTest.php
@@ -20,6 +20,7 @@ public function dataFileAsserts(): iterable
20
}
21
22
yield from $this->gatherAssertTypes(__DIR__ . '/data/tree_builder.php');
23
24
yield from $this->gatherAssertTypes(__DIR__ . '/data/ExampleBaseCommand.php');
25
yield from $this->gatherAssertTypes(__DIR__ . '/data/ExampleOptionCommand.php');
26
yield from $this->gatherAssertTypes(__DIR__ . '/data/ExampleOptionLazyCommand.php');
@@ -51,6 +52,7 @@ public function dataFileAsserts(): iterable
yield from $this->gatherAssertTypes(__DIR__ . '/data/denormalizer.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/FormInterface_getErrors.php');
+ yield from $this->gatherAssertTypes(__DIR__ . '/data/cache.php');
/**
tests/Type/Symfony/data/cache.php
@@ -0,0 +1,22 @@
+<?php declare(strict_types = 1);
+namespace PHPStan\Type\Symfony\cache;
+use function PHPStan\Testing\assertType;
+function testCacheCallable(\Symfony\Contracts\Cache\CacheInterface $cache): void {
+ $result = $cache->get('foo', function (): string {
+ return '';
+ });
+ assertType('string', $result);
+};
+ * @param \Symfony\Contracts\Cache\CallbackInterface<\stdClass> $cb
+ function testCacheCallbackInterface(\Symfony\Contracts\Cache\CacheInterface $cache, \Symfony\Contracts\Cache\CallbackInterface $cb): void {
19
+ $result = $cache->get('foo',$cb);
+ assertType('stdClass', $result);
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments