From c018fc4979bd3f6cf6ac9aeaf7b52fa321d38a61 Mon Sep 17 00:00:00 2001 From: Sebastian Meyer Date: Wed, 3 Apr 2024 22:31:50 +0200 Subject: [PATCH] Add StrictQueue::dequeue() method --- src/DataStructures/StrictQueue.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/DataStructures/StrictQueue.php b/src/DataStructures/StrictQueue.php index 7ef4ec9..caa9cb4 100644 --- a/src/DataStructures/StrictQueue.php +++ b/src/DataStructures/StrictQueue.php @@ -25,6 +25,7 @@ namespace OCC\Basics\DataStructures; use OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException; use OCC\Basics\DataStructures\Traits\StrictSplDoublyLinkedListTrait; +use RuntimeException; use SplQueue; /** @@ -47,6 +48,20 @@ class StrictQueue extends SplQueue /** @use StrictSplDoublyLinkedListTrait */ use StrictSplDoublyLinkedListTrait; + /** + * Dequeue an item from the queue. + * + * @return AllowedType The dequeued item + * + * @throws RuntimeException if the queue is empty + * + * @api + */ + public function dequeue(): mixed + { + return $this->shift(); + } + /** * Add an item to the queue. *