Skip to content

Commit

Permalink
phpstan: Don't ignore missing hints for generic collections
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Feb 12, 2024
1 parent f14ee18 commit 5a631de
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ parameters:
checkFunctionNameCase: true
checkInternalClassCaseSensitivity: true
treatPhpDocTypesAsCertain: false
checkGenericClassInNonGenericObjectType: false

paths:
- src
Expand Down
1 change: 1 addition & 0 deletions src/Filter/Chain.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use OutOfBoundsException;
use Traversable;

/** @implements IteratorAggregate<int, Rule> */
abstract class Chain implements Rule, MetaDataProvider, IteratorAggregate, Countable
{
use MetaData;
Expand Down
13 changes: 11 additions & 2 deletions src/PriorityQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,25 @@

/**
* Stable priority queue that also maintains insertion order for items with the same priority
*
* @template TPriority
* @template TValue
* @extends SplPriorityQueue<array{TPriority, int}, TValue>
*/
class PriorityQueue extends SplPriorityQueue
{
/** @var int */
protected $serial = PHP_INT_MAX;

/**
* @inheritDoc
* Inserts an element in the queue by sifting it up.
*
* Maintains insertion order for items with the same priority.
*
* @param TValue $value
* @param TPriority $priority
*
* @return bool
*/
public function insert($value, $priority): bool
{
Expand All @@ -36,7 +45,7 @@ public function yieldAll()
$queue->setExtractFlags(static::EXTR_BOTH);

foreach ($queue as $item) {
/** @var array{priority: array{0: mixed, 1: int}, data: mixed} $item */
/** @var array{priority: array{0: TPriority, 1: int}, data: TValue} $item */
yield $item['priority'][0] => $item['data'];
}
}
Expand Down

0 comments on commit 5a631de

Please sign in to comment.