Skip to content

Commit 7a6901f

Browse files
committed
feat: implement hasUser in IntrospectGuard.php for compatability
1 parent e8500d6 commit 7a6901f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Guard/IntrospectGuard.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,24 @@ class IntrospectGuard implements Guard
1111
{
1212
protected $user = false;
1313

14+
private Introspect $introspect;
15+
1416
public function __construct(Introspect $introspect)
1517
{
1618
$this->introspect = $introspect;
1719
}
1820

19-
public function authenticate()
21+
public function authenticate(): bool
2022
{
2123
return $this->check();
2224
}
2325

24-
public function check()
26+
public function check(): bool
2527
{
2628
return !is_null($this->user());
2729
}
2830

29-
public function guest()
31+
public function guest(): bool
3032
{
3133
return !$this->check();
3234
}
@@ -36,7 +38,7 @@ public function id()
3638
return $this->check() ? $this->user()->getKey() : null;
3739
}
3840

39-
public function user()
41+
public function user(): ?Authenticatable
4042
{
4143
if ($this->user === false) {
4244
try {
@@ -60,4 +62,9 @@ public function validate(array $credentials = []): bool
6062
{
6163
return true;
6264
}
65+
66+
public function hasUser(): bool
67+
{
68+
return $this->user !== false;
69+
}
6370
}

0 commit comments

Comments
 (0)