Skip to content

Commit 45b9b2d

Browse files
committed
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
1 parent 213fa2c commit 45b9b2d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Flare.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,7 @@ public function report(Throwable $throwable, callable $callback = null): ?Report
210210
call_user_func($callback, $report);
211211
}
212212

213-
$this->sendReportToApi($report);
214-
215-
return $report;
213+
return $this->sendReportToApi($report);
216214
}
217215

218216
protected function shouldSendReport(Throwable $throwable): bool
@@ -240,7 +238,7 @@ public function reportMessage(string $message, string $logLevel, callable $callb
240238
call_user_func($callback, $report);
241239
}
242240

243-
$this->sendReportToApi($report);
241+
return $this->sendReportToApi($report);
244242
}
245243

246244
public function sendTestReport(Throwable $throwable)
@@ -252,14 +250,17 @@ private function sendReportToApi(Report $report)
252250
{
253251
if ($this->filterReportsCallable) {
254252
if (! call_user_func($this->filterReportsCallable, $report)) {
255-
return;
253+
return null;
256254
}
257255
}
258256

259257
try {
260258
$this->api->report($report);
261259
} catch (Exception $exception) {
260+
return null;
262261
}
262+
263+
return $report;
263264
}
264265

265266
public function reset()

0 commit comments

Comments
 (0)