Remove unnecessary indirection method

This commit is contained in:
Aaron Piotrowski 2023-02-14 14:23:07 -06:00
parent a4b23892a1
commit 0a86594cf3
No known key found for this signature in database
GPG Key ID: 5B456E6AABA44A63
4 changed files with 2 additions and 19 deletions

View File

@ -8,9 +8,4 @@ namespace Amp\Parallel\Context;
final class ContextPanicError extends \Error
{
use Internal\ContextException;
protected function invokeExceptionConstructor(string $message, ?\Throwable $previous): void
{
parent::__construct($message, 0, $previous);
}
}

View File

@ -28,7 +28,7 @@ trait ContextException
. ' if the Xdebug extension is enabled, set "xdebug.mode" to "debug" to include'
. ' the exception stack trace in the context in the exception message';
$this->invokeExceptionConstructor(\sprintf(
parent::__construct(\sprintf(
$format,
$className,
$originalMessage,
@ -36,11 +36,9 @@ trait ContextException
$originalFile,
$originalLine,
self::class,
), $previous);
), previous: $previous);
}
abstract protected function invokeExceptionConstructor(string $message, ?\Throwable $previous): void;
public function __toString(): string
{
return \sprintf("%s\nStack trace in context:\n%s", $this->getMessage(), $this->getOriginalTraceAsString());

View File

@ -7,9 +7,4 @@ use Amp\Parallel\Context\Internal;
final class TaskFailureError extends \Error implements TaskFailureThrowable
{
use Internal\ContextException;
protected function invokeExceptionConstructor(string $message, ?\Throwable $previous): void
{
parent::__construct($message, 0, $previous);
}
}

View File

@ -7,9 +7,4 @@ use Amp\Parallel\Context\Internal;
final class TaskFailureException extends \Exception implements TaskFailureThrowable
{
use Internal\ContextException;
protected function invokeExceptionConstructor(string $message, ?\Throwable $previous): void
{
parent::__construct($message, 0, $previous);
}
}