xref: /PHP-8.2/ext/spl/spl_heap.stub.php (revision b73f139c)
1<?php
2
3/** @generate-class-entries */
4
5class SplPriorityQueue implements Iterator, Countable
6{
7    /**
8     * @var int
9     * @cvalue SPL_PQUEUE_EXTR_BOTH
10     */
11    public const EXTR_BOTH = UNKNOWN;
12    /**
13     * @var int
14     * @cvalue SPL_PQUEUE_EXTR_PRIORITY
15     */
16    public const EXTR_PRIORITY = UNKNOWN;
17    /**
18     * @var int
19     * @cvalue SPL_PQUEUE_EXTR_DATA
20     */
21    public const EXTR_DATA = UNKNOWN;
22
23    /** @tentative-return-type */
24    public function compare(mixed $priority1, mixed $priority2): int {}
25
26    /** @return bool */
27    public function insert(mixed $value, mixed $priority) {} // TODO make return type void
28
29    /** @tentative-return-type */
30    public function setExtractFlags(int $flags): int {}
31
32    /** @tentative-return-type */
33    public function top(): mixed {}
34
35    /** @tentative-return-type */
36    public function extract(): mixed {}
37
38    /**
39     * @tentative-return-type
40     * @implementation-alias SplHeap::count
41     */
42    public function count(): int {}
43
44    /**
45     * @tentative-return-type
46     * @implementation-alias SplHeap::isEmpty
47     */
48    public function isEmpty(): bool {}
49
50    /**
51     * @tentative-return-type
52     * @implementation-alias SplHeap::rewind
53     */
54    public function rewind(): void {}
55
56    /** @tentative-return-type */
57    public function current(): mixed {}
58
59    /**
60     * @tentative-return-type
61     * @implementation-alias SplHeap::key
62     */
63    public function key(): int {}
64
65    /**
66     * @tentative-return-type
67     * @implementation-alias SplHeap::next
68     */
69    public function next(): void {}
70
71    /**
72     * @tentative-return-type
73     * @implementation-alias SplHeap::valid
74     */
75    public function valid(): bool {}
76
77    /**
78     * @return bool
79     * @implementation-alias SplHeap::recoverFromCorruption
80     */
81    public function recoverFromCorruption() {} // TODO make return type void
82
83    /**
84     * @tentative-return-type
85     * @implementation-alias SplHeap::isCorrupted
86     */
87    public function isCorrupted(): bool {}
88
89    /** @tentative-return-type */
90    public function getExtractFlags(): int {}
91
92    /** @tentative-return-type */
93    public function __debugInfo(): array {}
94}
95
96abstract class SplHeap implements Iterator, Countable
97{
98    /** @tentative-return-type */
99    public function extract(): mixed {}
100
101    /** @tentative-return-type */
102    public function insert(mixed $value): bool {}
103
104    /** @tentative-return-type */
105    public function top(): mixed {}
106
107    /** @tentative-return-type */
108    public function count(): int {}
109
110    /** @tentative-return-type */
111    public function isEmpty(): bool {}
112
113    /** @tentative-return-type */
114    public function rewind(): void {}
115
116    /** @tentative-return-type */
117    public function current(): mixed {}
118
119    /** @tentative-return-type */
120    public function key(): int {}
121
122    /** @tentative-return-type */
123    public function next(): void {}
124
125    /** @tentative-return-type */
126    public function valid(): bool {}
127
128    /** @tentative-return-type */
129    public function recoverFromCorruption(): bool {}
130
131    /** @tentative-return-type */
132    abstract protected function compare(mixed $value1, mixed $value2): int;
133
134    /** @tentative-return-type */
135    public function isCorrupted(): bool {}
136
137    /** @tentative-return-type */
138    public function __debugInfo(): array {}
139}
140
141class SplMinHeap extends SplHeap
142{
143    /** @tentative-return-type */
144    protected function compare(mixed $value1, mixed $value2): int {}
145}
146
147class SplMaxHeap extends SplHeap
148{
149    /** @tentative-return-type */
150    protected function compare(mixed $value1, mixed $value2): int {}
151}
152