Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpstan: Don't ignore missing hints for generic collections #52

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading