From 45b9b2d075aa61bcdfc7f2bdb2aec92e6232884c Mon Sep 17 00:00:00 2001 From: Jellyfrog Date: Tue, 23 Aug 2022 18:48:23 +0200 Subject: [PATCH] Return output of filterReportsCallable Current code will populate Flare::sentReports() even if it's filtered since the return from sendReportToApi() is not used: $this->sendReportToApi($report); return $report; This is a regression from #33 --- src/Flare.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Flare.php b/src/Flare.php index ca623b8..b93b24b 100755 --- a/src/Flare.php +++ b/src/Flare.php @@ -210,9 +210,7 @@ public function report(Throwable $throwable, callable $callback = null): ?Report call_user_func($callback, $report); } - $this->sendReportToApi($report); - - return $report; + return $this->sendReportToApi($report); } protected function shouldSendReport(Throwable $throwable): bool @@ -240,7 +238,7 @@ public function reportMessage(string $message, string $logLevel, callable $callb call_user_func($callback, $report); } - $this->sendReportToApi($report); + return $this->sendReportToApi($report); } public function sendTestReport(Throwable $throwable) @@ -252,14 +250,17 @@ private function sendReportToApi(Report $report) { if ($this->filterReportsCallable) { if (! call_user_func($this->filterReportsCallable, $report)) { - return; + return null; } } try { $this->api->report($report); } catch (Exception $exception) { + return null; } + + return $report; } public function reset()