xref: /php-src/ext/spl/spl_observer.stub.php (revision 577db994)
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     */
92    public function offsetSet($object, mixed $info = null): void {}
93
94    /**
95     * @param object $object
96     * @tentative-return-type
97     * @implementation-alias SplObjectStorage::detach
98     */
99    public function offsetUnset($object): void {}
100
101    /** @tentative-return-type */
102    public function getHash(object $object): string {}
103
104    /** @tentative-return-type */
105    public function __serialize(): array {}
106
107    /** @tentative-return-type */
108    public function __unserialize(array $data): void {}
109
110    /** @tentative-return-type */
111    public function __debugInfo(): array {}
112}
113
114class MultipleIterator implements Iterator
115{
116    /** @cvalue MIT_NEED_ANY */
117    public const int MIT_NEED_ANY = UNKNOWN;
118    /** @cvalue MIT_NEED_ALL */
119    public const int MIT_NEED_ALL = UNKNOWN;
120    /** @cvalue MIT_KEYS_NUMERIC */
121    public const int MIT_KEYS_NUMERIC = UNKNOWN;
122    /** @cvalue MIT_KEYS_ASSOC */
123    public const int MIT_KEYS_ASSOC = UNKNOWN;
124
125    public function __construct(int $flags = MultipleIterator::MIT_NEED_ALL|MultipleIterator::MIT_KEYS_NUMERIC) {}
126
127    /** @tentative-return-type */
128    public function getFlags(): int {}
129
130    /** @tentative-return-type */
131    public function setFlags(int $flags): void {}
132
133    /** @tentative-return-type */
134    public function attachIterator(Iterator $iterator, string|int|null $info = null): void {}
135
136    /** @tentative-return-type */
137    public function detachIterator(Iterator $iterator): void {}
138
139    /** @tentative-return-type */
140    public function containsIterator(Iterator $iterator): bool {}
141
142    /** @tentative-return-type */
143    public function countIterators(): int {}
144
145    /** @tentative-return-type */
146    public function rewind(): void {}
147
148    /** @tentative-return-type */
149    public function valid(): bool {}
150
151    /** @tentative-return-type */
152    public function key(): array {}
153
154    /** @tentative-return-type */
155    public function current(): array {}
156
157    /** @tentative-return-type */
158    public function next(): void {}
159
160    /**
161     * @tentative-return-type
162     * @implementation-alias SplObjectStorage::__debugInfo
163     */
164    public function __debugInfo(): array {}
165}
166