Skip to content

Commit

Permalink
Add StrictQueue::dequeue() method
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-meyer committed Apr 3, 2024
1 parent 3fddb39 commit c018fc4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/DataStructures/StrictQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

use OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException;
use OCC\Basics\DataStructures\Traits\StrictSplDoublyLinkedListTrait;
use RuntimeException;
use SplQueue;

/**
Expand All @@ -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.
*
Expand Down

0 comments on commit c018fc4

Please sign in to comment.