Skip to content

Commit

Permalink
Add \Error stub (#3002)
Browse files Browse the repository at this point in the history
Otherwise, errors are generated if \Error is extended: https://psalm.dev/r/8169465beb
  • Loading branch information
kelunik authored Mar 21, 2020
1 parent dd9924e commit a7affbe
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/Psalm/Internal/Stubs/CoreImmutableClasses.phpstub
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,57 @@ class Exception implements Throwable
*/
public final function getLine(){}
}

class Error implements Throwable
{
/**
* @var string
*/
protected $message = '';

/**
* @var int
*/
protected $code = 0;

/**
* @var string
*/
protected $file = '';

/**
* @var int
*/
protected $line = 0;

/**
* @psalm-external-mutation-free
* @param string $message
* @param int $code
* @param Throwable $previous
*/
public function __construct($message = "", $code = 0, Throwable $previous = null) {}

/**
* @psalm-mutation-free
*/
public final function getMessage() : string {}

/**
* @psalm-mutation-free
* @return int|string
*/
public final function getCode(){}

/**
* @psalm-mutation-free
* @return string
*/
public final function getFile(){}

/**
* @psalm-mutation-free
* @return int
*/
public final function getLine(){}
}

0 comments on commit a7affbe

Please sign in to comment.