Skip to content

Commit 5507979

Browse files
abdelrahmenAymantegos
authored andcommitted
fix: replace log function and logger helper return type ?LogManager with ?LoggerInterface (laravel#57028)
1 parent 87e58bb commit 5507979

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/Illuminate/Foundation/helpers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,9 @@ function lang_path($path = ''): string
560560
* Log a debug message to the logs.
561561
*
562562
* @param string|null $message
563-
* @return ($message is null ? \Illuminate\Log\LogManager : null)
563+
* @return ($message is null ? \Psr\Log\LoggerInterface : null)
564564
*/
565-
function logger($message = null, array $context = []): ?LogManager
565+
function logger($message = null, array $context = []): ?LoggerInterface
566566
{
567567
if (is_null($message)) {
568568
return app('log');

src/Illuminate/Log/functions.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22

33
namespace Illuminate\Log;
44

5+
use Psr\Log\LoggerInterface;
6+
57
if (! function_exists('Illuminate\Log\log')) {
68
/**
79
* Log a debug message to the logs.
810
*
911
* @param string|null $message
1012
* @param array $context
11-
* @return ($message is null ? \Illuminate\Log\LogManager : null)
13+
* @return ($message is null ? \Psr\Log\LoggerInterface: null)
1214
*/
13-
function log($message = null, array $context = []): ?LogManager
15+
function log($message = null, array $context = []): ?LoggerInterface
1416
{
1517
return logger($message, $context);
1618
}

types/Foundation/Helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
assertType('Illuminate\Foundation\Bus\PendingDispatch', dispatch('foo'));
3030
assertType('Illuminate\Foundation\Bus\PendingClosureDispatch', dispatch(fn () => 1));
3131

32-
assertType('Illuminate\Log\LogManager', logger());
32+
assertType('Psr\Log\LoggerInterface', logger());
3333
assertType('null', logger('foo'));
3434

3535
assertType('Illuminate\Log\LogManager', logs());

0 commit comments

Comments
 (0)