xref: /php-src/ext/spl/spl_observer.stub.php (revision f97bd071)
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, SeekableIterator, 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    public function seek(int $offset): void {}
68
69    /** @tentative-return-type */
70    public function unserialize(string $data): void {}
71
72    /** @tentative-return-type */
73    public function serialize(): string {}
74
75    /**
76     * @param object $object
77     * @tentative-return-type
78     * @implementation-alias SplObjectStorage::contains
79     * @no-verify Cannot specify arg type because ArrayAccess does not
80     */
81    public function offsetExists($object): bool {}
82
83    /**
84     * @param object $object
85     * @tentative-return-type
86     */
87    public function offsetGet($object): mixed {}
88
89    /**
90     * @param object $object
91     * @tentative-return-type
92     * @implementation-alias SplObjectStorage::attach
93     */
94    public function offsetSet($object, mixed $info = null): void {}
95
96    /**
97     * @param object $object
98     * @tentative-return-type
99     * @implementation-alias SplObjectStorage::detach
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    /** @cvalue MIT_NEED_ANY */
119    public const int MIT_NEED_ANY = UNKNOWN;
120    /** @cvalue MIT_NEED_ALL */
121    public const int MIT_NEED_ALL = UNKNOWN;
122    /** @cvalue MIT_KEYS_NUMERIC */
123    public const int MIT_KEYS_NUMERIC = UNKNOWN;
124    /** @cvalue MIT_KEYS_ASSOC */
125    public const int MIT_KEYS_ASSOC = UNKNOWN;
126
127    public function __construct(int $flags = MultipleIterator::MIT_NEED_ALL|MultipleIterator::MIT_KEYS_NUMERIC) {}
128
129    /** @tentative-return-type */
130    public function getFlags(): int {}
131
132    /** @tentative-return-type */
133    public function setFlags(int $flags): void {}
134
135    /** @tentative-return-type */
136    public function attachIterator(Iterator $iterator, string|int|null $info = null): void {}
137
138    /** @tentative-return-type */
139    public function detachIterator(Iterator $iterator): void {}
140
141    /** @tentative-return-type */
142    public function containsIterator(Iterator $iterator): bool {}
143
144    /** @tentative-return-type */
145    public function countIterators(): int {}
146
147    /** @tentative-return-type */
148    public function rewind(): void {}
149
150    /** @tentative-return-type */
151    public function valid(): bool {}
152
153    /** @tentative-return-type */
154    public function key(): array {}
155
156    /** @tentative-return-type */
157    public function current(): array {}
158
159    /** @tentative-return-type */
160    public function next(): void {}
161
162    /**
163     * @tentative-return-type
164     * @implementation-alias SplObjectStorage::__debugInfo
165     */
166    public function __debugInfo(): array {}
167}
168