Skip to content

Commit 64f6c62

Browse files
committed
Extended with the CallbackInterface $callback param type
1 parent 333a1c4 commit 64f6c62

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

extension.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ parameters:
5252
- stubs/Symfony/Component/Validator/ConstraintViolationInterface.stub
5353
- stubs/Symfony/Component/Validator/ConstraintViolationListInterface.stub
5454
- stubs/Symfony/Contracts/Cache/CacheInterface.stub
55+
- stubs/Symfony/Contracts/Cache/CallbackInterface.stub
5556
- stubs/Twig/Node/Node.stub
5657

5758
parametersSchema:

stubs/Symfony/Contracts/Cache/CacheInterface.stub

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
namespace Symfony\Contracts\Cache;
44

5-
class CacheInterface
5+
interface CacheInterface
66
{
77
/**
88
* @template T
99
*
10-
* @param callable:T $callback
10+
* @param \Symfony\Contracts\Cache\CallbackInterface<T>|callable(\Psr\Cache\CacheItemInterface): T $callback
11+
* @param array<mixed> $metadata
1112
* @return T
1213
*/
1314
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Symfony\Contracts\Cache;
4+
5+
use Psr\Cache\CacheItemInterface;
6+
7+
/**
8+
* @template T
9+
*/
10+
interface CallbackInterface
11+
{
12+
/**
13+
* @return T
14+
*/
15+
public function __invoke(CacheItemInterface $item, bool &$save);
16+
}

0 commit comments

Comments
 (0)