style: lint

This commit is contained in:
李东云
2023-06-19 10:50:07 +08:00
parent e34433c59a
commit 383bd13c64
3 changed files with 7 additions and 19 deletions

View File

@@ -25,16 +25,10 @@ class AppAuthentication implements AuthenticationInterface
private $user;
/**
* @Inject()
* @var RequestInterface
*/
#[Inject]
private RequestInterface $request;
/**
* @Inject()
* @var Redis
*/
#[Inject]
private Redis $redis;
public function __construct()

View File

@@ -40,10 +40,7 @@ class JwtAuthentication implements AuthenticationInterface
use JustDont;
use CannotInvalid;
/**
* @Inject()
* @var \Hyperf\HttpServer\Contract\RequestInterface
*/
#[Inject]
private RequestInterface $request;
public function generate(User $user): string
@@ -90,7 +87,7 @@ class JwtAuthentication implements AuthenticationInterface
throw new Unauthorized($error_code, $exception);
}
if (empty($decoded)) {
throw new ValidateException(CommonErrorCode::AUTH_JWT_ERROR, 'token', $decoded);
throw new ValidateException(CommonErrorCode::AUTH_JWT_ERROR, 'token', currentValue: $decoded);
}
// 判断签发机构
@@ -169,7 +166,7 @@ class JwtAuthentication implements AuthenticationInterface
/** @var \Singularity\HDK\Auth\Resource\JsonWebToken $currentUser */
$currentUser = Context::get('jwt');
if (empty($currentUser)) {
throw new Unauthorized(RFC7616::DIGEST);
throw new Unauthorized();
}
if (isset($column)) {

View File

@@ -24,10 +24,7 @@ use Singularity\HDK\Auth\Services\AuthenticationInterface;
*/
trait LoginRequired
{
/**
* @Inject()
* @var AuthenticationInterface
*/
#[Inject]
private AuthenticationInterface $authentication;
public function authorize(): bool {