Skip to content

Commit aef19cd

Browse files
authored
fix: base class guard in return types is breaking custom guards (#56779)
* fix: base class guard in return types * review: remove unused guard * fix: failing type check
1 parent aa671fd commit aef19cd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Illuminate/Foundation/helpers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Illuminate\Container\Container;
77
use Illuminate\Contracts\Auth\Access\Gate;
88
use Illuminate\Contracts\Auth\Factory as AuthFactory;
9-
use Illuminate\Contracts\Auth\StatefulGuard;
9+
use Illuminate\Contracts\Auth\Guard;
1010
use Illuminate\Contracts\Broadcasting\Factory as BroadcastFactory;
1111
use Illuminate\Contracts\Bus\Dispatcher;
1212
use Illuminate\Contracts\Cookie\Factory as CookieFactory;
@@ -169,9 +169,9 @@ function asset($path, $secure = null): string
169169
* Get the available auth instance.
170170
*
171171
* @param string|null $guard
172-
* @return ($guard is null ? \Illuminate\Contracts\Auth\Factory : \Illuminate\Contracts\Auth\StatefulGuard)
172+
* @return ($guard is null ? \Illuminate\Contracts\Auth\Factory : \Illuminate\Contracts\Auth\Guard)
173173
*/
174-
function auth($guard = null): AuthFactory|StatefulGuard
174+
function auth($guard = null): AuthFactory|Guard
175175
{
176176
if (is_null($guard)) {
177177
return app(AuthFactory::class);

types/Foundation/Helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
assertType('Illuminate\Config\Repository', app(Repository::class));
1010

1111
assertType('Illuminate\Contracts\Auth\Factory', auth());
12-
assertType('Illuminate\Contracts\Auth\StatefulGuard', auth('foo'));
12+
assertType('Illuminate\Contracts\Auth\Guard', auth('foo'));
1313

1414
assertType('Illuminate\Cache\CacheManager', cache());
1515
assertType('bool', cache(['foo' => 'bar'], 42));

0 commit comments

Comments
 (0)