diff --git a/src/PriorityQueue.php b/src/PriorityQueue.php index 0a832538..3b67dc6e 100644 --- a/src/PriorityQueue.php +++ b/src/PriorityQueue.php @@ -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 */ class PriorityQueue implements Countable, IteratorAggregate, Serializable diff --git a/src/SplPriorityQueue.php b/src/SplPriorityQueue.php index 294b86ff..c4d12978 100644 --- a/src/SplPriorityQueue.php +++ b/src/SplPriorityQueue.php @@ -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 */ class SplPriorityQueue extends \SplPriorityQueue implements Serializable diff --git a/test/StaticAnalysis/PriorityQueueGenericsCanBeUnderstood.php b/test/StaticAnalysis/PriorityQueueGenericsCanBeUnderstood.php new file mode 100644 index 00000000..72423c3f --- /dev/null +++ b/test/StaticAnalysis/PriorityQueueGenericsCanBeUnderstood.php @@ -0,0 +1,31 @@ + */ + private PriorityQueue $laminas; + + /** + * @param PriorityQueue $laminas + */ + public function __construct( + PriorityQueue $laminas + ) { + $this->laminas = $laminas; + } + + /** @return list */ + public function laminasList(): array + { + return array_values(iterator_to_array($this->laminas)); + } +} diff --git a/test/StaticAnalysis/PriorityQueueGenericsShouldMatchSplPriorityQueue.php b/test/StaticAnalysis/PriorityQueueGenericsShouldMatchSplPriorityQueue.php deleted file mode 100644 index 37516cd8..00000000 --- a/test/StaticAnalysis/PriorityQueueGenericsShouldMatchSplPriorityQueue.php +++ /dev/null @@ -1,43 +0,0 @@ - */ - private PriorityQueue $laminas; - /** @var SplPriorityQueue */ - private SplPriorityQueue $native; - - /** - * @param PriorityQueue $laminas - * @param SplPriorityQueue $native - */ - public function __construct( - PriorityQueue $laminas, - SplPriorityQueue $native - ) { - $this->laminas = $laminas; - $this->native = $native; - } - - /** @return list */ - public function laminasList(): array - { - return array_values(iterator_to_array($this->laminas)); - } - - /** @return list */ - public function nativeList(): array - { - return array_values(iterator_to_array($this->native)); - } -} diff --git a/test/StaticAnalysis/SplPriorityQueueGenericsCanBeUnderstood.php b/test/StaticAnalysis/SplPriorityQueueGenericsCanBeUnderstood.php new file mode 100644 index 00000000..303e9a20 --- /dev/null +++ b/test/StaticAnalysis/SplPriorityQueueGenericsCanBeUnderstood.php @@ -0,0 +1,31 @@ + */ + private SplPriorityQueue $laminas; + + /** + * @param SplPriorityQueue $laminas + */ + public function __construct( + SplPriorityQueue $laminas + ) { + $this->laminas = $laminas; + } + + /** @return list */ + public function laminasList(): array + { + return array_values(iterator_to_array($this->laminas)); + } +} diff --git a/test/StaticAnalysis/SplPriorityQueueGenericsShouldMatchNativeSplPriorityQueue.php b/test/StaticAnalysis/SplPriorityQueueGenericsShouldMatchNativeSplPriorityQueue.php deleted file mode 100644 index fe3cf8dc..00000000 --- a/test/StaticAnalysis/SplPriorityQueueGenericsShouldMatchNativeSplPriorityQueue.php +++ /dev/null @@ -1,43 +0,0 @@ - */ - private SplPriorityQueue $laminas; - /** @var NativeSplPriorityQueue */ - private NativeSplPriorityQueue $native; - - /** - * @param SplPriorityQueue $laminas - * @param NativeSplPriorityQueue $native - */ - public function __construct( - SplPriorityQueue $laminas, - NativeSplPriorityQueue $native - ) { - $this->laminas = $laminas; - $this->native = $native; - } - - /** @return list */ - public function laminasList(): array - { - return array_values(iterator_to_array($this->laminas)); - } - - /** @return list */ - public function nativeList(): array - { - return array_values(iterator_to_array($this->native)); - } -}