<?php

declare(strict_types=1);

namespace Spiral\Core\Exception\Resolver;

final class WrongTypeException extends ResolvingException
{
    public function __construct(
        \ReflectionFunctionAbstract $reflection,
        \TypeError $error,
        ?\Throwable $previous = null,
    ) {
        $message = 'An argument resolved with wrong type: ';
        parent::__construct(
            $message . $error->getMessage(),
            $error->getCode(),
            $previous ?? $error,
        );
    }
}
