Skip to content

Commit

Permalink
Revert 'fix' for template order. Update test cases to reflect expecte…
Browse files Browse the repository at this point in the history
…d inference

Signed-off-by: George Steel <[email protected]>
  • Loading branch information
gsteel committed Aug 24, 2022
1 parent ff46973 commit 381b958
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 88 deletions.
2 changes: 1 addition & 1 deletion src/PriorityQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
* "inner" iterator in the form of an SplPriorityQueue object for performing
* the actual iteration.
*
* @template TPriority of int
* @template TValue
* @template TPriority of int
* @implements IteratorAggregate<array-key, TValue>
*/
class PriorityQueue implements Countable, IteratorAggregate, Serializable
Expand Down
2 changes: 1 addition & 1 deletion src/SplPriorityQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
* Also, provides predictable heap order for datums added with the same priority
* (i.e., they will be emitted in the same order they are enqueued).
*
* @template TPriority of int
* @template TValue
* @template TPriority of int
* @extends \SplPriorityQueue<TPriority, TValue>
*/
class SplPriorityQueue extends \SplPriorityQueue implements Serializable
Expand Down
31 changes: 31 additions & 0 deletions test/StaticAnalysis/PriorityQueueGenericsCanBeUnderstood.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace LaminasTest\Stdlib\StaticAnalysis;

use Laminas\Stdlib\PriorityQueue;

use function array_values;
use function iterator_to_array;

final class PriorityQueueGenericsCanBeUnderstood
{
/** @var PriorityQueue<string, int> */
private PriorityQueue $laminas;

/**
* @param PriorityQueue<string, int> $laminas
*/
public function __construct(
PriorityQueue $laminas
) {
$this->laminas = $laminas;
}

/** @return list<string> */
public function laminasList(): array
{
return array_values(iterator_to_array($this->laminas));
}
}

This file was deleted.

31 changes: 31 additions & 0 deletions test/StaticAnalysis/SplPriorityQueueGenericsCanBeUnderstood.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace LaminasTest\Stdlib\StaticAnalysis;

use Laminas\Stdlib\SplPriorityQueue;

use function array_values;
use function iterator_to_array;

final class SplPriorityQueueGenericsCanBeUnderstood
{
/** @var SplPriorityQueue<string, int> */
private SplPriorityQueue $laminas;

/**
* @param SplPriorityQueue<string, int> $laminas
*/
public function __construct(
SplPriorityQueue $laminas
) {
$this->laminas = $laminas;
}

/** @return list<string> */
public function laminasList(): array
{
return array_values(iterator_to_array($this->laminas));
}
}

This file was deleted.

0 comments on commit 381b958

Please sign in to comment.