Skip to content

Commit 9aa2f01

Browse files
committed
Mark immediately invoked callback params
1 parent e26fd3c commit 9aa2f01

File tree

3 files changed

+93
-0
lines changed

3 files changed

+93
-0
lines changed

stubs/Collections/ReadableCollection.stub

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,73 @@ use IteratorAggregate;
1313
interface ReadableCollection extends Countable, IteratorAggregate
1414
{
1515

16+
/**
17+
* @param-immediately-invoked-callable $p
18+
*
19+
* @param Closure(TKey, T):bool $p
20+
*
21+
* @return bool
22+
*/
23+
public function exists(Closure $p);
24+
25+
/**
26+
* @param-immediately-invoked-callable $p
27+
*
28+
* @param Closure(T, TKey):bool $p
29+
*
30+
* @return ReadableCollection<TKey, T>
31+
*/
32+
public function filter(Closure $p);
33+
34+
/**
35+
* @param-immediately-invoked-callable $func
36+
*
37+
* @param Closure(T):U $func
38+
*
39+
* @return ReadableCollection<TKey, U>
40+
*
41+
* @template U
42+
*/
43+
public function map(Closure $func);
44+
45+
/**
46+
* @param-immediately-invoked-callable $p
47+
*
48+
* @param Closure(TKey, T):bool $p
49+
*
50+
* @return array{0: ReadableCollection<TKey, T>, 1: ReadableCollection<TKey, T>}
51+
*/
52+
public function partition(Closure $p);
53+
54+
/**
55+
* @param-immediately-invoked-callable $p
56+
*
57+
* @param Closure(TKey, T):bool $p
58+
*
59+
* @return bool TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.
60+
*/
61+
public function forAll(Closure $p);
62+
63+
/**
64+
* @param-immediately-invoked-callable $p
65+
*
66+
* @param Closure(TKey, T):bool $p
67+
*
68+
* @return T|null
69+
*/
70+
public function findFirst(Closure $p);
71+
72+
/**
73+
* @param-immediately-invoked-callable $func
74+
*
75+
* @param Closure(TReturn|TInitial, T):TReturn $func
76+
* @param TInitial $initial
77+
*
78+
* @return TReturn|TInitial
79+
*
80+
* @template TReturn
81+
* @template TInitial
82+
*/
83+
public function reduce(Closure $func, mixed $initial = null);
84+
1685
}

stubs/DBAL/Connection.stub

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace Doctrine\DBAL;
55
use Doctrine\DBAL\Cache\CacheException;
66
use Doctrine\DBAL\Cache\QueryCacheProfile;
77
use Doctrine\DBAL\Types\Type;
8+
use Throwable;
89

910
class Connection
1011
{
@@ -61,4 +62,15 @@ class Connection
6162
*/
6263
public function executeCacheQuery($sql, $params, $types, QueryCacheProfile $qcp): Result;
6364

65+
/**
66+
* @param-immediately-invoked-callable $func
67+
* @param callable(self): T $func
68+
* @return T
69+
*
70+
* @template T
71+
*
72+
* @throws Throwable
73+
*/
74+
public function transactional(Closure $func);
75+
6476
}

stubs/DBAL/Connection4.stub

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace Doctrine\DBAL;
55
use Doctrine\DBAL\Cache\CacheException;
66
use Doctrine\DBAL\Cache\QueryCacheProfile;
77
use Doctrine\DBAL\Types\Type;
8+
use Throwable;
89

910
/**
1011
* @phpstan-type WrapperParameterType = string|Type|ParameterType|ArrayParameterType
@@ -65,4 +66,15 @@ class Connection
6566
*/
6667
public function executeCacheQuery($sql, $params, $types, QueryCacheProfile $qcp): Result;
6768

69+
/**
70+
* @param-immediately-invoked-callable $func
71+
* @param callable(self): T $func
72+
* @return T
73+
*
74+
* @template T
75+
*
76+
* @throws Throwable
77+
*/
78+
public function transactional(Closure $func);
79+
6880
}

0 commit comments

Comments
 (0)