mirror of
https://github.com/opencultureconsulting/php-basics.git
synced 2025-02-23 00:00:24 +01:00
Add StrictQueue::dequeue() method
This commit is contained in:
parent
3fddb3981e
commit
c018fc4979
@ -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.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user