Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4e9c77f

Browse files
xificurkondrejmirtes
authored andcommitted
Add modified stub for ReadableCollection from doctrine/collections 1.x
1 parent 80f3b5f commit 4e9c77f

File tree

3 files changed

+88
-1
lines changed

3 files changed

+88
-1
lines changed

‎extension.neon‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ parameters:
4343
- stubs/Persistence/ObjectRepository.stub
4444
- stubs/RepositoryFactory.stub
4545
- stubs/Collections/ArrayCollection.stub
46-
- stubs/Collections/ReadableCollection.stub
4746
- stubs/Collections/Selectable.stub
4847
- stubs/ORM/AbstractQuery.stub
4948
- stubs/ORM/Exception/ORMException.stub

‎src/Stubs/Doctrine/StubFilesExtensionLoader.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ public function getFiles(): array
6464
$collectionVersion = null;
6565
}
6666
if ($collectionVersion !== null && strpos($collectionVersion, '1.') === 0) {
67+
$files[] = $stubsDir . '/Collections/ReadableCollection1.stub';
6768
$files[] = $stubsDir . '/Collections/Collection1.stub';
6869
} else {
70+
$files[] = $stubsDir . '/Collections/ReadableCollection.stub';
6971
$files[] = $stubsDir . '/Collections/Collection.stub';
7072
}
7173

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
3+
namespace Doctrine\Common\Collections;
4+
5+
use Closure;
6+
use Countable;
7+
use IteratorAggregate;
8+
9+
/**
10+
* @template TKey of array-key
11+
* @template-covariant T
12+
* @extends IteratorAggregate<TKey, T>
13+
*/
14+
interface ReadableCollection extends Countable, IteratorAggregate
15+
{
16+
17+
/**
18+
* @param-immediately-invoked-callable $p
19+
*
20+
* @param Closure(TKey, T):bool $p
21+
*
22+
* @return bool
23+
*/
24+
public function exists(Closure $p);
25+
26+
/**
27+
* @param-immediately-invoked-callable $p
28+
*
29+
* @param Closure(T, TKey):bool $p
30+
*
31+
* @return ReadableCollection<TKey, T>
32+
*/
33+
public function filter(Closure $p);
34+
35+
/**
36+
* @param-immediately-invoked-callable $func
37+
*
38+
* @param Closure(T):U $func
39+
*
40+
* @return Collection<TKey, U>
41+
*
42+
* @template U
43+
*/
44+
public function map(Closure $func);
45+
46+
/**
47+
* @param-immediately-invoked-callable $p
48+
*
49+
* @param Closure(TKey, T):bool $p
50+
*
51+
* @return array{0: ReadableCollection<TKey, T>, 1: ReadableCollection<TKey, T>}
52+
*/
53+
public function partition(Closure $p);
54+
55+
/**
56+
* @param-immediately-invoked-callable $p
57+
*
58+
* @param Closure(TKey, T):bool $p
59+
*
60+
* @return bool TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.
61+
*/
62+
public function forAll(Closure $p);
63+
64+
/**
65+
* @param-immediately-invoked-callable $p
66+
*
67+
* @param Closure(TKey, T):bool $p
68+
*
69+
* @return T|null
70+
*/
71+
public function findFirst(Closure $p);
72+
73+
/**
74+
* @param-immediately-invoked-callable $func
75+
*
76+
* @param Closure(TReturn|TInitial, T):TReturn $func
77+
* @param TInitial $initial
78+
*
79+
* @return TReturn|TInitial
80+
*
81+
* @template TReturn
82+
* @template TInitial
83+
*/
84+
public function reduce(Closure $func, mixed $initial = null);
85+
86+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /