upgraded dependencies

This commit is contained in:
RafficMohammed
2023-01-08 01:59:16 +05:30
parent 51056e3aad
commit f9ae387337
6895 changed files with 133617 additions and 178680 deletions

View File

@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
* (c) 2012-2018 Justin Hileman
* (c) 2012-2022 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -21,7 +21,7 @@ class BreakException extends \Exception implements Exception
/**
* {@inheritdoc}
*/
public function __construct($message = '', $code = 0, \Exception $previous = null)
public function __construct($message = '', $code = 0, \Throwable $previous = null)
{
$this->rawMessage = $message;
parent::__construct(\sprintf('Exit: %s', $message), $code, $previous);
@@ -32,7 +32,7 @@ class BreakException extends \Exception implements Exception
*
* @return string
*/
public function getRawMessage()
public function getRawMessage(): string
{
return $this->rawMessage;
}

View File

@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
* (c) 2012-2018 Justin Hileman
* (c) 2012-2022 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.

View File

@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
* (c) 2012-2018 Justin Hileman
* (c) 2012-2022 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -21,14 +21,14 @@ class ErrorException extends \ErrorException implements Exception
/**
* Construct a Psy ErrorException.
*
* @param string $message (default: "")
* @param int $code (default: 0)
* @param int $severity (default: 1)
* @param string $filename (default: null)
* @param int $lineno (default: null)
* @param Exception $previous (default: null)
* @param string $message (default: "")
* @param int $code (default: 0)
* @param int $severity (default: 1)
* @param string|null $filename (default: null)
* @param int|null $lineno (default: null)
* @param \Throwable|null $previous (default: null)
*/
public function __construct($message = '', $code = 0, $severity = 1, $filename = null, $lineno = null, $previous = null)
public function __construct($message = '', $code = 0, $severity = 1, $filename = null, $lineno = null, \Throwable $previous = null)
{
$this->rawMessage = $message;
@@ -37,28 +37,28 @@ class ErrorException extends \ErrorException implements Exception
}
switch ($severity) {
case E_STRICT:
case \E_STRICT:
$type = 'Strict error';
break;
case E_NOTICE:
case E_USER_NOTICE:
case \E_NOTICE:
case \E_USER_NOTICE:
$type = 'Notice';
break;
case E_WARNING:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
case E_USER_WARNING:
case \E_WARNING:
case \E_CORE_WARNING:
case \E_COMPILE_WARNING:
case \E_USER_WARNING:
$type = 'Warning';
break;
case E_DEPRECATED:
case E_USER_DEPRECATED:
case \E_DEPRECATED:
case \E_USER_DEPRECATED:
$type = 'Deprecated';
break;
case E_RECOVERABLE_ERROR:
case \E_RECOVERABLE_ERROR:
$type = 'Recoverable fatal error';
break;
@@ -67,7 +67,7 @@ class ErrorException extends \ErrorException implements Exception
break;
}
$message = \sprintf('PHP %s: %s%s on line %d', $type, $message, $filename ? ' in ' . $filename : '', $lineno);
$message = \sprintf('PHP %s: %s%s on line %d', $type, $message, $filename ? ' in '.$filename : '', $lineno);
parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
}
@@ -76,7 +76,7 @@ class ErrorException extends \ErrorException implements Exception
*
* @return string
*/
public function getRawMessage()
public function getRawMessage(): string
{
return $this->rawMessage;
}
@@ -86,9 +86,9 @@ class ErrorException extends \ErrorException implements Exception
*
* This allows us to:
*
* set_error_handler(array('Psy\Exception\ErrorException', 'throwException'));
* set_error_handler([ErrorException::class, 'throwException']);
*
* @throws ErrorException
* @throws self
*
* @param int $errno Error type
* @param string $errstr Message
@@ -103,11 +103,13 @@ class ErrorException extends \ErrorException implements Exception
/**
* Create an ErrorException from an Error.
*
* @deprecated psySH no longer wraps Errors
*
* @param \Error $e
*
* @return ErrorException
* @return self
*/
public static function fromError(\Error $e)
public static function fromError(\Error $e): self
{
return new self($e->getMessage(), $e->getCode(), 1, $e->getFile(), $e->getLine(), $e);
}

View File

@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
* (c) 2012-2018 Justin Hileman
* (c) 2012-2022 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.

View File

@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
* (c) 2012-2018 Justin Hileman
* (c) 2012-2022 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -21,14 +21,14 @@ class FatalErrorException extends \ErrorException implements Exception
/**
* Create a fatal error.
*
* @param string $message (default: "")
* @param int $code (default: 0)
* @param int $severity (default: 1)
* @param string $filename (default: null)
* @param int $lineno (default: null)
* @param \Exception $previous (default: null)
* @param string $message (default: "")
* @param int $code (default: 0)
* @param int $severity (default: 1)
* @param string|null $filename (default: null)
* @param int|null $lineno (default: null)
* @param \Throwable|null $previous (default: null)
*/
public function __construct($message = '', $code = 0, $severity = 1, $filename = null, $lineno = null, $previous = null)
public function __construct($message = '', $code = 0, $severity = 1, $filename = null, $lineno = null, \Throwable $previous = null)
{
// Since these are basically always PHP Parser Node line numbers, treat -1 as null.
if ($lineno === -1) {
@@ -45,7 +45,7 @@ class FatalErrorException extends \ErrorException implements Exception
*
* @return string
*/
public function getRawMessage()
public function getRawMessage(): string
{
return $this->rawMessage;
}

View File

@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
* (c) 2012-2018 Justin Hileman
* (c) 2012-2022 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -22,7 +22,7 @@ class ParseErrorException extends \PhpParser\Error implements Exception
* @param string $message (default: "")
* @param int $line (default: -1)
*/
public function __construct($message = '', $line = -1)
public function __construct(string $message = '', int $line = -1)
{
$message = \sprintf('PHP Parse error: %s', $message);
parent::__construct($message, $line);
@@ -33,9 +33,9 @@ class ParseErrorException extends \PhpParser\Error implements Exception
*
* @param \PhpParser\Error $e
*
* @return ParseErrorException
* @return self
*/
public static function fromParseError(\PhpParser\Error $e)
public static function fromParseError(\PhpParser\Error $e): self
{
return new self($e->getRawMessage(), $e->getStartLine());
}

View File

@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
* (c) 2012-2018 Justin Hileman
* (c) 2012-2022 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -21,11 +21,11 @@ class RuntimeException extends \RuntimeException implements Exception
/**
* Make this bad boy.
*
* @param string $message (default: "")
* @param int $code (default: 0)
* @param \Exception $previous (default: null)
* @param string $message (default: "")
* @param int $code (default: 0)
* @param \Throwable|null $previous (default: null)
*/
public function __construct($message = '', $code = 0, \Exception $previous = null)
public function __construct(string $message = '', int $code = 0, \Throwable $previous = null)
{
$this->rawMessage = $message;
parent::__construct($message, $code, $previous);
@@ -36,7 +36,7 @@ class RuntimeException extends \RuntimeException implements Exception
*
* @return string
*/
public function getRawMessage()
public function getRawMessage(): string
{
return $this->rawMessage;
}

View File

@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
* (c) 2012-2018 Justin Hileman
* (c) 2012-2022 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -19,10 +19,10 @@ class ThrowUpException extends \Exception implements Exception
/**
* {@inheritdoc}
*/
public function __construct(\Exception $exception)
public function __construct(\Throwable $throwable)
{
$message = \sprintf("Throwing %s with message '%s'", \get_class($exception), $exception->getMessage());
parent::__construct($message, $exception->getCode(), $exception);
$message = \sprintf("Throwing %s with message '%s'", \get_class($throwable), $throwable->getMessage());
parent::__construct($message, $throwable->getCode(), $throwable);
}
/**
@@ -30,7 +30,7 @@ class ThrowUpException extends \Exception implements Exception
*
* @return string
*/
public function getRawMessage()
public function getRawMessage(): string
{
return $this->getPrevious()->getMessage();
}
@@ -38,11 +38,13 @@ class ThrowUpException extends \Exception implements Exception
/**
* Create a ThrowUpException from a Throwable.
*
* @deprecated psySH no longer wraps Throwables
*
* @param \Throwable $throwable
*
* @return ThrowUpException
* @return self
*/
public static function fromThrowable($throwable)
public static function fromThrowable($throwable): self
{
if ($throwable instanceof \Error) {
$throwable = ErrorException::fromError($throwable);

View File

@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
* (c) 2012-2018 Justin Hileman
* (c) 2012-2022 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -21,14 +21,17 @@ class TypeErrorException extends \Exception implements Exception
/**
* Constructor!
*
* @param string $message (default: "")
* @param int $code (default: 0)
* @deprecated psySH no longer wraps TypeErrors
*
* @param string $message (default: "")
* @param int $code (default: 0)
* @param \Throwable|null $previous (default: null)
*/
public function __construct($message = '', $code = 0)
public function __construct(string $message = '', int $code = 0, \Throwable $previous = null)
{
$this->rawMessage = $message;
$message = \preg_replace('/, called in .*?: eval\\(\\)\'d code/', '', $message);
parent::__construct(\sprintf('TypeError: %s', $message), $code);
parent::__construct(\sprintf('TypeError: %s', $message), $code, $previous);
}
/**
@@ -36,7 +39,7 @@ class TypeErrorException extends \Exception implements Exception
*
* @return string
*/
public function getRawMessage()
public function getRawMessage(): string
{
return $this->rawMessage;
}
@@ -44,12 +47,14 @@ class TypeErrorException extends \Exception implements Exception
/**
* Create a TypeErrorException from a TypeError.
*
* @deprecated psySH no longer wraps TypeErrors
*
* @param \TypeError $e
*
* @return TypeErrorException
* @return self
*/
public static function fromTypeError(\TypeError $e)
public static function fromTypeError(\TypeError $e): self
{
return new self($e->getMessage(), $e->getCode());
return new self($e->getMessage(), $e->getCode(), $e);
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* This file is part of Psy Shell.
*
* (c) 2012-2022 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Psy\Exception;
class UnexpectedTargetException extends RuntimeException
{
private $target;
/**
* @param mixed $target
* @param string $message (default: "")
* @param int $code (default: 0)
* @param \Throwable|null $previous (default: null)
*/
public function __construct($target, string $message = '', int $code = 0, \Throwable $previous = null)
{
$this->target = $target;
parent::__construct($message, $code, $previous);
}
/**
* @return mixed
*/
public function getTarget()
{
return $this->target;
}
}