Skip to content

Commit 831c631

Browse files
committed
fix: correct PHPStan errors in ErrorListenerIntegration and Options
- ErrorListenerIntegration: revert closure return type to bool (required by set_error_handler contract) and cast previous handler result with (bool) to safely handle null returns from chained handlers - Options: fix beforeSend PHPDoc second param from array<string,mixed> to EventHint|null to match actual call site in Client::prepareEvent
1 parent c1ec7f7 commit 831c631

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/logtide/src/Integration/ErrorListenerIntegration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function setupOnce(): void
2929
string $message,
3030
string $file,
3131
int $line,
32-
): ?bool {
32+
): bool {
3333
if (!(error_reporting() & $severity)) {
3434
return false;
3535
}
@@ -43,7 +43,7 @@ public function setupOnce(): void
4343
$hub->captureEvent($event);
4444

4545
if ($this->previousHandler !== null) {
46-
return ($this->previousHandler)($severity, $message, $file, $line);
46+
return (bool) ($this->previousHandler)($severity, $message, $file, $line);
4747
}
4848

4949
return false;

packages/logtide/src/Options.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ final class Options
3737

3838
private ?TransportInterface $transport = null;
3939

40-
/** @var (\Closure(Event, array<string, mixed>): ?Event)|null */
40+
/** @var (\Closure(Event, EventHint|null): ?Event)|null */
4141
private ?\Closure $beforeSend = null;
4242

4343
/** @var (\Closure(Breadcrumb\Breadcrumb): ?Breadcrumb\Breadcrumb)|null */
@@ -263,7 +263,7 @@ public function getTransport(): ?TransportInterface
263263
return $this->transport;
264264
}
265265

266-
/** @return (\Closure(Event, array<string, mixed>): ?Event)|null */
266+
/** @return (\Closure(Event, EventHint|null): ?Event)|null */
267267
public function getBeforeSend(): ?\Closure
268268
{
269269
return $this->beforeSend;

0 commit comments

Comments
 (0)