Files
hyperf_data/extend/Aether/PHP/Hyperf/Exception/ValidationFailedException.php
2025-09-25 09:12:22 +08:00

36 lines
903 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
declare(strict_types=1);
namespace Aether\Exception;
use Hyperf\Validation\ValidationException;
use Hyperf\Validation\Validator;
use Psr\Http\Message\ResponseInterface;
class ValidationFailedException extends ValidationException
{
/**
* 验证场景.
*/
protected string $scene;
public function __construct(
Validator $validator,
string $scene,
string $message = '参数验证失败',
?ResponseInterface $response = null // 新增response参数符合父类要求
) {
// 父类构造函数仅接受 $validator 和 $response
parent::__construct($validator, $response);
// 单独设置消息(父类的 $message 为 protected 属性,可直接赋值)
$this->message = $message;
$this->scene = $scene;
}
public function getScene(): string
{
return $this->scene;
}
}