Add StrictQueue::dequeue() method

This commit is contained in:
Sebastian Meyer 2024-04-03 22:31:50 +02:00 committed by Sebastian Meyer
parent 3fddb3981e
commit c018fc4979
1 changed files with 15 additions and 0 deletions

View File

@ -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<AllowedType> */
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.
*