xref: /PHP-8.2/ext/spl/spl_observer.stub.php (revision b73f139c)
1<?php
2
3/** @generate-class-entries */
4
5interface SplObserver
6{
7    /** @tentative-return-type */
8    public function update(SplSubject $subject): void;
9}
10
11interface SplSubject
12{
13    /** @tentative-return-type */
14    public function attach(SplObserver $observer): void;
15
16    /** @tentative-return-type */
17    public function detach(SplObserver $observer): void;
18
19    /** @tentative-return-type */
20    public function notify(): void;
21}
22
23class SplObjectStorage implements Countable, Iterator, Serializable, ArrayAccess
24{
25    /** @tentative-return-type */
26    public function attach(object $object, mixed $info = null): void {}
27
28    /** @tentative-return-type */
29    public function detach(object $object): void {}
30
31    /** @tentative-return-type */
32    public function contains(object $object): bool {}
33
34    /** @tentative-return-type */
35    public function addAll(SplObjectStorage $storage): int {}
36
37    /** @tentative-return-type */
38    public function removeAll(SplObjectStorage $storage): int {}
39
40    /** @tentative-return-type */
41    public function removeAllExcept(SplObjectStorage $storage): int {}
42
43    /** @tentative-return-type */
44    public function getInfo(): mixed {}
45
46    /** @tentative-return-type */
47    public function setInfo(mixed $info): void {}
48
49    /** @tentative-return-type */
50    public function count(int $mode = COUNT_NORMAL): int {}
51
52    /** @tentative-return-type */
53    public function rewind(): void {}
54
55    /** @tentative-return-type */
56    public function valid(): bool {}
57
58    /** @tentative-return-type */
59    public function key(): int {}
60
61    /** @tentative-return-type */
62    public function current(): object {}
63
64    /** @tentative-return-type */
65    public function next(): void {}
66
67    /** @tentative-return-type */
68    public function unserialize(string $data): void {}
69
70    /** @tentative-return-type */
71    public function serialize(): string {}
72
73    /**
74     * @param object $object
75     * @tentative-return-type
76     * @implementation-alias SplObjectStorage::contains
77     * @no-verify Cannot specify arg type because ArrayAccess does not
78     */
79    public function offsetExists($object): bool {}
80
81    /**
82     * @param object $object
83     * @tentative-return-type
84     */
85    public function offsetGet($object): mixed {}
86
87    /**
88     * @param object $object
89     * @tentative-return-type
90     * @implementation-alias SplObjectStorage::attach
91     * @no-verify Cannot specify arg type because ArrayAccess does not
92     */
93    public function offsetSet($object, mixed $info = null): void {}
94
95    /**
96     * @param object $object
97     * @tentative-return-type
98     * @implementation-alias SplObjectStorage::detach
99     * @no-verify Cannot specify arg type because ArrayAccess does not
100     */
101    public function offsetUnset($object): void {}
102
103    /** @tentative-return-type */
104    public function getHash(object $object): string {}
105
106    /** @tentative-return-type */
107    public function __serialize(): array {}
108
109    /** @tentative-return-type */
110    public function __unserialize(array $data): void {}
111
112    /** @tentative-return-type */
113    public function __debugInfo(): array {}
114}
115
116class MultipleIterator implements Iterator
117{
118    /**
119     * @var int
120     * @cvalue MIT_NEED_ANY
121     */
122    public const MIT_NEED_ANY = UNKNOWN;
123    /**
124     * @var int
125     * @cvalue MIT_NEED_ALL
126     */
127    public const MIT_NEED_ALL = UNKNOWN;
128    /**
129     * @var int
130     * @cvalue MIT_KEYS_NUMERIC
131     */
132    public const MIT_KEYS_NUMERIC = UNKNOWN;
133    /**
134     * @var int
135     * @cvalue MIT_KEYS_ASSOC
136     */
137    public const MIT_KEYS_ASSOC = UNKNOWN;
138
139    public function __construct(int $flags = MultipleIterator::MIT_NEED_ALL|MultipleIterator::MIT_KEYS_NUMERIC) {}
140
141    /** @tentative-return-type */
142    public function getFlags(): int {}
143
144    /** @tentative-return-type */
145    public function setFlags(int $flags): void {}
146
147    /** @tentative-return-type */
148    public function attachIterator(Iterator $iterator, string|int|null $info = null): void {}
149
150    /** @tentative-return-type */
151    public function detachIterator(Iterator $iterator): void {}
152
153    /** @tentative-return-type */
154    public function containsIterator(Iterator $iterator): bool {}
155
156    /** @tentative-return-type */
157    public function countIterators(): int {}
158
159    /** @tentative-return-type */
160    public function rewind(): void {}
161
162    /** @tentative-return-type */
163    public function valid(): bool {}
164
165    /** @tentative-return-type */
166    public function key(): array {}
167
168    /** @tentative-return-type */
169    public function current(): array {}
170
171    /** @tentative-return-type */
172    public function next(): void {}
173
174    /**
175     * @tentative-return-type
176     * @implementation-alias SplObjectStorage::__debugInfo
177     */
178    public function __debugInfo(): array {}
179}
180