-
-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9186239
commit 5dec3fd
Showing
3 changed files
with
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ parameters: | |
level: 8 | ||
paths: | ||
- src | ||
- tests/StaticAnalysis | ||
|
||
ignoreErrors: | ||
- | ||
|
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,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\Common\Collections\StaticAnalysis; | ||
|
||
use Closure; | ||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Doctrine\Common\Collections\Collection; | ||
|
||
/** | ||
* @phpstan-template TKey of array-key | ||
* @phpstan-template T of object | ||
* @phpstan-implements Collection<TKey, T> | ||
*/ | ||
abstract class CustomCollection implements Collection | ||
{ | ||
/** @var ArrayCollection<TKey, T> */ | ||
private ArrayCollection $collection; | ||
|
||
/** @param ArrayCollection<TKey, T> $arrayCollection */ | ||
public function __construct(ArrayCollection $arrayCollection) | ||
{ | ||
$this->collection = $arrayCollection; | ||
} | ||
|
||
/** | ||
* @psalm-param Closure(T, TKey):bool $p | ||
* | ||
* @return Collection<TKey, T> | ||
*/ | ||
public function filter(Closure $p) | ||
{ | ||
return $this->collection->filter($p); | ||
} | ||
|
||
/** | ||
* @psalm-param Closure(TKey, T):bool $p | ||
* | ||
* @psalm-return array{0: Collection<TKey, T>, 1: Collection<TKey, T>} | ||
*/ | ||
public function partition(Closure $p) | ||
{ | ||
return $this->collection->partition($p); | ||
} | ||
} |