Skip to content

Commit a7affbe

Browse files
authored
Add \Error stub (#3002)
Otherwise, errors are generated if \Error is extended: https://psalm.dev/r/8169465beb
1 parent dd9924e commit a7affbe

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

src/Psalm/Internal/Stubs/CoreImmutableClasses.phpstub

+54
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,57 @@ class Exception implements Throwable
7777
*/
7878
public final function getLine(){}
7979
}
80+
81+
class Error implements Throwable
82+
{
83+
/**
84+
* @var string
85+
*/
86+
protected $message = '';
87+
88+
/**
89+
* @var int
90+
*/
91+
protected $code = 0;
92+
93+
/**
94+
* @var string
95+
*/
96+
protected $file = '';
97+
98+
/**
99+
* @var int
100+
*/
101+
protected $line = 0;
102+
103+
/**
104+
* @psalm-external-mutation-free
105+
* @param string $message
106+
* @param int $code
107+
* @param Throwable $previous
108+
*/
109+
public function __construct($message = "", $code = 0, Throwable $previous = null) {}
110+
111+
/**
112+
* @psalm-mutation-free
113+
*/
114+
public final function getMessage() : string {}
115+
116+
/**
117+
* @psalm-mutation-free
118+
* @return int|string
119+
*/
120+
public final function getCode(){}
121+
122+
/**
123+
* @psalm-mutation-free
124+
* @return string
125+
*/
126+
public final function getFile(){}
127+
128+
/**
129+
* @psalm-mutation-free
130+
* @return int
131+
*/
132+
public final function getLine(){}
133+
}

0 commit comments

Comments
 (0)