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