xref: /PHP-8.1/Zend/zend_exceptions.stub.php (revision 8168d312)
1<?php
2
3/** @generate-class-entries */
4
5interface Throwable extends Stringable
6{
7    public function getMessage(): string;
8
9    /** @return int */
10    public function getCode();
11
12    public function getFile(): string;
13
14    public function getLine(): int;
15
16    public function getTrace(): array;
17
18    public function getPrevious(): ?Throwable;
19
20    public function getTraceAsString(): string;
21}
22
23class Exception implements Throwable
24{
25    /**
26     * Intentionally left untyped for BC reasons
27     * @var string
28     */
29    protected $message = "";
30    private string $string = "";
31    /**
32     * Intentionally left untyped for BC reasons
33     * @var int
34     */
35    protected $code = 0;
36    protected string $file = "";
37    protected int $line = 0;
38    private array $trace = [];
39    private ?Throwable $previous = null;
40
41    private function __clone(): void {}
42
43    public function __construct(string $message = "", int $code = 0, ?Throwable $previous = null) {}
44
45    /** @tentative-return-type */
46    public function __wakeup(): void {}
47
48    final public function getMessage(): string {}
49
50    /** @return int */
51    final public function getCode() {}
52
53    final public function getFile(): string {}
54
55    final public function getLine(): int {}
56
57    final public function getTrace(): array {}
58
59    final public function getPrevious(): ?Throwable {}
60
61    final public function getTraceAsString(): string {}
62
63    public function __toString(): string {}
64}
65
66class ErrorException extends Exception
67{
68    protected int $severity = E_ERROR;
69
70    public function __construct(
71        string $message = "",
72        int $code = 0,
73        int $severity = E_ERROR,
74        ?string $filename = null,
75        ?int $line = null,
76        ?Throwable $previous = null
77    ) {}
78
79    final public function getSeverity(): int {}
80}
81
82class Error implements Throwable
83{
84    /**
85     * Intentionally left untyped for BC reasons
86     * @var string
87     */
88    protected $message = "";
89    private string $string = "";
90    /**
91     * Intentionally left untyped for BC reasons
92     * @var int
93     */
94    protected $code = 0;
95    protected string $file = "";
96    protected int $line;
97    private array $trace = [];
98    private ?Throwable $previous = null;
99
100    /** @implementation-alias Exception::__clone */
101    private function __clone(): void {}
102
103    /** @implementation-alias Exception::__construct */
104    public function __construct(string $message = "", int $code = 0, ?Throwable $previous = null) {}
105
106    /**
107     * @tentative-return-type
108     * @implementation-alias Exception::__wakeup
109     */
110    public function __wakeup(): void {}
111
112    /** @implementation-alias Exception::getMessage */
113    final public function getMessage(): string {}
114
115    /**
116     * @return int
117     * @implementation-alias Exception::getCode
118     */
119    final public function getCode() {}
120
121    /** @implementation-alias Exception::getFile */
122    final public function getFile(): string {}
123
124    /** @implementation-alias Exception::getLine */
125    final public function getLine(): int {}
126
127    /** @implementation-alias Exception::getTrace */
128    final public function getTrace(): array {}
129
130    /** @implementation-alias Exception::getPrevious */
131    final public function getPrevious(): ?Throwable {}
132
133    /** @implementation-alias Exception::getTraceAsString */
134    final public function getTraceAsString(): string {}
135
136    /** @implementation-alias Exception::__toString */
137    public function __toString(): string {}
138}
139
140class CompileError extends Error
141{
142}
143
144class ParseError extends CompileError
145{
146}
147
148class TypeError extends Error
149{
150}
151
152class ArgumentCountError extends TypeError
153{
154}
155
156class ValueError extends Error
157{
158}
159
160class ArithmeticError extends Error
161{
162}
163
164class DivisionByZeroError extends ArithmeticError
165{
166}
167
168class UnhandledMatchError extends Error
169{
170}
171