Skip to content

Commit c317fa9

Browse files
committed
feature: apply rector
1 parent d28327e commit c317fa9

7 files changed

Lines changed: 7 additions & 19 deletions

File tree

src/AuthManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class AuthManager
1717
*/
1818
public function guard(?string $name = null): GuardInterface
1919
{
20-
$name = $name ?? (string)ConfigHelper::get(('auth.default'));
20+
$name ??= (string)ConfigHelper::get(('auth.default'));
2121
if (!isset($this->guards[$name])) {
2222
$this->guards[$name] = $this->createGuard($this->getConfig($name));
2323
}

src/Authentication/FailureHandler/RedirectHandler.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@
1111
*/
1212
class RedirectHandler implements AuthenticationFailureHandlerInterface
1313
{
14-
protected string $redirectUrl;
15-
16-
public function __construct(string $redirectUrl)
14+
public function __construct(protected string $redirectUrl)
1715
{
18-
$this->redirectUrl = $redirectUrl;
1916
}
2017

2118
/**

src/Authentication/Method/BaseMethod.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@
99

1010
abstract class BaseMethod implements AuthenticationMethodInterface
1111
{
12-
protected IdentityRepositoryInterface $identityRepository;
1312
protected ?string $tokenType = null;
1413

15-
public function __construct(IdentityRepositoryInterface $identityRepository, array $config = [])
14+
public function __construct(protected IdentityRepositoryInterface $identityRepository, array $config = [])
1615
{
1716
foreach ($config as $key => $value) {
1817
$this->{$key} = $value;
1918
}
20-
$this->identityRepository = $identityRepository;
2119
}
2220

2321
/**

src/Authentication/Method/CompositeMethod.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@
88

99
class CompositeMethod implements AuthenticationMethodInterface
1010
{
11-
protected array $methods;
12-
13-
public function __construct(array $methods)
11+
public function __construct(protected array $methods)
1412
{
15-
$this->methods = $methods;
16-
1713
foreach ($this->methods as $method) {
1814
if (!$method instanceof AuthenticationMethodInterface) {
1915
throw new \InvalidArgumentException('$method must be ' . AuthenticationMethodInterface::class);

src/Authentication/Method/HttpBasicMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected function getCredentials(Request $request): ?string
1919
{
2020
if ($credentials = parent::getCredentials($request)) {
2121
$credentials = base64_decode($credentials);
22-
if (strpos($credentials, ':') !== false) {
22+
if (str_contains($credentials, ':')) {
2323
return $credentials;
2424
}
2525
}

src/Authentication/Method/TinywanJwtMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct(IdentityRepositoryInterface $identity, array $config
2020
{
2121
parent::__construct($identity, $config);
2222

23-
if (!class_exists('Tinywan\Jwt\JwtToken')) {
23+
if (!class_exists(\Tinywan\Jwt\JwtToken::class)) {
2424
throw new InvalidArgumentException('请先安装 tinywan/jwt: composer require tinywan/jwt');
2525
}
2626
}

src/Middleware/SetAuthGuard.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@ class SetAuthGuard implements MiddlewareInterface
1313
{
1414
public const REQUEST_GUARD_NAME = 'auth_current_guard_name';
1515

16-
protected ?string $guardName;
17-
18-
public function __construct(?string $guardName = null)
16+
public function __construct(protected ?string $guardName = null)
1917
{
20-
$this->guardName = $guardName;
2118
}
2219

2320
/**

0 commit comments

Comments
 (0)