Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Illuminate/Log/Context/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,14 @@ protected function isHiddenStackable($key)
}

/**
* @template TReturn of mixed
*
* Run the callback function with the given context values and restore the original context state when complete.
*
* @param callable $callback
* @param (callable(): TReturn) $callback
* @param array<string, mixed> $data
* @param array<string, mixed> $hidden
* @return mixed
* @return TReturn
*
* @throws \Throwable
*/
Expand Down
15 changes: 15 additions & 0 deletions types/Log/Context.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

use Illuminate\Events\Dispatcher;
use Illuminate\Log\Context\Repository;

use function PHPStan\Testing\assertType;

$repository = new Repository(new Dispatcher());

$value = $repository->scope(fn (): int => random_int(-100, 100));
assertType('int<-100, 100>', $value);

$void = $repository->scope(function () { // @phpstan-ignore method.void
});
assertType('null', $void);