-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add modified stub for ReadableCollection from doctrine/collections 1.x
- Loading branch information
Showing
2 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
|
||
namespace Doctrine\Common\Collections; | ||
|
||
use Closure; | ||
use Countable; | ||
use IteratorAggregate; | ||
|
||
/** | ||
* @template TKey of array-key | ||
* @template-covariant T | ||
* @extends IteratorAggregate<TKey, T> | ||
*/ | ||
interface ReadableCollection extends Countable, IteratorAggregate | ||
Check failure on line 14 in stubs/Collections/ReadableCollection1.stub GitHub Actions / PHPStan (7.3)
Check failure on line 14 in stubs/Collections/ReadableCollection1.stub GitHub Actions / PHPStan (7.4)
|
||
{ | ||
|
||
/** | ||
* @param-immediately-invoked-callable $p | ||
* | ||
* @param Closure(TKey, T):bool $p | ||
* | ||
* @return bool | ||
*/ | ||
public function exists(Closure $p); | ||
|
||
/** | ||
* @param-immediately-invoked-callable $p | ||
* | ||
* @param Closure(T, TKey):bool $p | ||
* | ||
* @return ReadableCollection<TKey, T> | ||
*/ | ||
public function filter(Closure $p); | ||
|
||
/** | ||
* @param-immediately-invoked-callable $func | ||
* | ||
* @param Closure(T):U $func | ||
* | ||
* @return Collection<TKey, U> | ||
* | ||
* @template U | ||
*/ | ||
public function map(Closure $func); | ||
|
||
/** | ||
* @param-immediately-invoked-callable $p | ||
* | ||
* @param Closure(TKey, T):bool $p | ||
* | ||
* @return array{0: ReadableCollection<TKey, T>, 1: ReadableCollection<TKey, T>} | ||
*/ | ||
public function partition(Closure $p); | ||
|
||
/** | ||
* @param-immediately-invoked-callable $p | ||
* | ||
* @param Closure(TKey, T):bool $p | ||
* | ||
* @return bool TRUE, if the predicate yields TRUE for all elements, FALSE otherwise. | ||
*/ | ||
public function forAll(Closure $p); | ||
|
||
/** | ||
* @param-immediately-invoked-callable $p | ||
* | ||
* @param Closure(TKey, T):bool $p | ||
* | ||
* @return T|null | ||
*/ | ||
public function findFirst(Closure $p); | ||
|
||
/** | ||
* @param-immediately-invoked-callable $func | ||
* | ||
* @param Closure(TReturn|TInitial, T):TReturn $func | ||
* @param TInitial $initial | ||
* | ||
* @return TReturn|TInitial | ||
* | ||
* @template TReturn | ||
* @template TInitial | ||
*/ | ||
public function reduce(Closure $func, mixed $initial = null); | ||
|
||
} |