diff --git a/composer.json b/composer.json index 448783e..fe67677 100644 --- a/composer.json +++ b/composer.json @@ -29,19 +29,19 @@ } }, "require": { - "php": ">=7.3", + "php": ">=8.0", "ext-swoole": ">=4.5", - "hyperf-ext/hashing": "~2.2.0", - "hyperf/command": "~2.2.0", - "hyperf/config": "~2.2.0", - "hyperf/database": "~2.2.0", - "hyperf/db-connection": "~2.2.0", - "hyperf/di": "~2.2.0", - "hyperf/framework": "~2.2.0" + "hyperf-ext/hashing": "~3.0.0", + "hyperf/command": "~3.0.0", + "hyperf/config": "~3.0.0", + "hyperf/database": "~3.0.0", + "hyperf/db-connection": "~3.0.0", + "hyperf/di": "~3.0.0", + "hyperf/framework": "~3.0.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.0", - "hyperf/testing": "~2.2.0", + "hyperf/testing": "~3.0.0", "phpstan/phpstan": "^0.12", "swoole/ide-helper": "dev-master", "mockery/mockery": "^1.0" diff --git a/src/Aspect/AuthAspect.php b/src/Aspect/AuthAspect.php index f782838..53fb881 100644 --- a/src/Aspect/AuthAspect.php +++ b/src/Aspect/AuthAspect.php @@ -1,6 +1,6 @@ getAnnotationMetadata(); - $authAnnotation = $annotation->class[Auth::class] ?? $annotation->method[Auth::class]; - $guards = empty($authAnnotation->guards) ? [null] : $authAnnotation->guards; $passable = $authAnnotation->passable; - foreach ($guards as $name) { $guard = $this->auth->guard($name); - - if (! $guard->user() instanceof AuthenticatableInterface and ! $passable) { + if (!$guard->user() instanceof AuthenticatableInterface and !$passable) { throw new AuthenticationException('Unauthenticated.', $guards); } } - return $proceedingJoinPoint->process(); } -} +} \ No newline at end of file diff --git a/src/Guards/JwtGuard.php b/src/Guards/JwtGuard.php index a3cf275..5bc7bd7 100644 --- a/src/Guards/JwtGuard.php +++ b/src/Guards/JwtGuard.php @@ -12,7 +12,7 @@ use BadMethodCallException; use Hyperf\HttpServer\Contract\RequestInterface; -use Hyperf\Utils\Traits\Macroable; +use Hyperf\Macroable\Macroable; use HyperfExt\Auth\Contracts\AuthenticatableInterface; use HyperfExt\Auth\Contracts\StatelessGuardInterface; use HyperfExt\Auth\Contracts\UserProviderInterface; diff --git a/src/Guards/SessionGuard.php b/src/Guards/SessionGuard.php index aab78b4..007a0d8 100644 --- a/src/Guards/SessionGuard.php +++ b/src/Guards/SessionGuard.php @@ -13,7 +13,7 @@ use Hyperf\Contract\SessionInterface; use Hyperf\HttpMessage\Cookie\Cookie; use Hyperf\Utils\Str; -use Hyperf\Utils\Traits\Macroable; +use Hyperf\Macroable\Macroable; use HyperfExt\Auth\Contracts\AuthenticatableInterface; use HyperfExt\Auth\Contracts\StatefulGuardInterface; use HyperfExt\Auth\Contracts\SupportsBasicAuthInterface;