33/** @generate-class-entries */
44
55/**
6- * A double-ended queue represented internally as a circular buffer.
6+ * A double-ended queue (Typically abbreviated as Deque, pronounced "deck", like "cheque")
7+ * represented internally as a circular buffer.
8+ *
79 * This has much lower memory usage than SplDoublyLinkedList or its subclasses (SplStack, SplStack),
810 * and operations are significantly faster than SplDoublyLinkedList.
911 *
12+ * See https://en.wikipedia.org/wiki/Double-ended_queue
13+ *
1014 * This supports amortized constant time pushing and popping onto the front or back of the array.
1115 *
1216 * Naming is based on https://www.php.net/spldoublylinkedlist
@@ -44,9 +48,15 @@ public static function __set_state(array $array): Deque {}
4448 public function push (mixed $ value ): void {}
4549 /** Prepends a value to the start of the Deque. */
4650 public function unshift (mixed $ value ): void {}
47- /** Pops a value from the end of the Deque. */
51+ /**
52+ * Pops a value from the end of the Deque.
53+ * @throws UnderflowException if the Deque is empty
54+ */
4855 public function pop (): mixed {}
49- /** Shifts a value from the front of the Deque. */
56+ /**
57+ * Shifts a value from the front of the Deque.
58+ * @throws UnderflowException if the Deque is empty
59+ */
5060 public function shift (): mixed {}
5161
5262 /** Peeks at the value at the start of the Deque, throws if empty */
@@ -57,13 +67,35 @@ public function top(): mixed {}
5767 /** Returns a list of the elements from front to back. */
5868 public function toArray (): array {}
5969 /* Get and set are strictly typed, unlike offsetGet/offsetSet. */
70+ /**
71+ * Returns the value at offset $offset (relative to the start of the Deque)
72+ * @throws OutOfBoundsException if the value of (int)$offset is not within the bounds of this vector
73+ */
6074 public function get (int $ offset ): mixed {}
75+ /**
76+ * Sets the value at offset $offset (relative to the start of the Deque) to $value
77+ * @throws OutOfBoundsException if the value of (int)$offset is not within the bounds of this vector
78+ */
6179 public function set (int $ offset , mixed $ value ): void {}
6280 // Must be mixed for compatibility with ArrayAccess
81+ /**
82+ * Returns the value at offset (int)$offset (relative to the start of the Deque)
83+ * @throws OutOfBoundsException if the value of (int)$offset is not within the bounds of this vector
84+ */
6385 public function offsetGet (mixed $ offset ): mixed {}
86+ /**
87+ * Returns true if `0 <= (int)$offset && (int)$offset < $this->count().
88+ */
6489 public function offsetExists (mixed $ offset ): bool {}
90+ /**
91+ * Sets the value at offset $offset (relative to the start of the Deque) to $value
92+ * @throws OutOfBoundsException if the value of (int)$offset is not within the bounds of this vector
93+ */
6594 public function offsetSet (mixed $ offset , mixed $ value ): void {}
6695 /** Throws unconditionally */
96+ /**
97+ * @throws RuntimeException unconditionally because unset and null are different things, unlike SplFixedArray
98+ */
6799 public function offsetUnset (mixed $ offset ): void {}
68100
69101 /** This is JSON serialized as a JSON array with elements from front to back */
0 commit comments