Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Aug 27, 2024
1 parent b5ec307 commit 450fcb1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Monolog/Handler/ElasticsearchHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ protected function bulkSend(array $records): void
*/
protected function createExceptionFromResponses($responses): Throwable
{
// @phpstan-ignore offsetAccess.nonOffsetAccessible
foreach ($responses['items'] ?? [] as $item) {
if (isset($item['index']['error'])) {
return $this->createExceptionFromError($item['index']['error']);
Expand Down
7 changes: 4 additions & 3 deletions src/Monolog/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class Logger implements LoggerInterface, ResettableInterface
private $logDepth = 0;

/**
* @var \WeakMap<\Fiber, int>|null Keeps track of depth inside fibers to prevent infinite logging loops
* @var \WeakMap<\Fiber<mixed, mixed, mixed, mixed>, int> Keeps track of depth inside fibers to prevent infinite logging loops
*/
private $fiberLogDepth;

Expand Down Expand Up @@ -197,7 +197,7 @@ public function __construct(string $name, array $handlers = [], array $processor

if (\PHP_VERSION_ID >= 80100) {
// Local variable for phpstan, see https://github.com/phpstan/phpstan/issues/6732#issuecomment-1111118412
/** @var \WeakMap<\Fiber, int> $fiberLogDepth */
/** @var \WeakMap<\Fiber<mixed, mixed, mixed, mixed>, int> $fiberLogDepth */
$fiberLogDepth = new \WeakMap();
$this->fiberLogDepth = $fiberLogDepth;
}
Expand Down Expand Up @@ -345,6 +345,7 @@ public function addRecord(int $level, string $message, array $context = [], ?Dat

if ($this->detectCycles) {
if (\PHP_VERSION_ID >= 80100 && $fiber = \Fiber::getCurrent()) {
// @phpstan-ignore offsetAssign.dimType
$this->fiberLogDepth[$fiber] = $this->fiberLogDepth[$fiber] ?? 0;
$logDepth = ++$this->fiberLogDepth[$fiber];
} else {
Expand Down Expand Up @@ -753,7 +754,7 @@ public function __unserialize(array $data): void

if (\PHP_VERSION_ID >= 80100) {
// Local variable for phpstan, see https://github.com/phpstan/phpstan/issues/6732#issuecomment-1111118412
/** @var \WeakMap<\Fiber, int> $fiberLogDepth */
/** @var \WeakMap<\Fiber<mixed, mixed, mixed, mixed>, int> $fiberLogDepth */
$fiberLogDepth = new \WeakMap();
$this->fiberLogDepth = $fiberLogDepth;
}
Expand Down

0 comments on commit 450fcb1

Please sign in to comment.