We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello, I have discovered probably a problem.
Im using Laravel DebuBar and when I want to register TraceablePDO class to track all PDO queries and run 0 queries, it gives error with return type.
TraceablePDO
Register (in Laravel ServiceProvider):
$pdo = new TraceablePDO(DB::getPdo()); app('debugbar')->addCollector(new PDOCollector($pdo)); DB::setPdo($pdo);
Error:
DebugBar\DataCollector\PDO\TraceablePDO::getAccumulatedStatementsDuration(): Return value must be of type float, null returned
After preventing from returning null, it works as it should.
Fix (in DebugBar\DataCollector\PDO\TraceablePDO):
DebugBar\DataCollector\PDO\TraceablePDO
/** * Returns the accumulated execution time of statements * * @return float */ public function getAccumulatedStatementsDuration() : float { return array_reduce($this->executedStatements, function ($v, $s) { return $v + $s->getDuration(); }) ?? 0; } /** * Returns the peak memory usage while performing statements * * @return int */ public function getMemoryUsage() : int { return array_reduce($this->executedStatements, function ($v, $s) { return $v + $s->getMemoryUsage(); }) ?? 0; } /** * Returns the peak memory usage while performing statements * * @return int */ public function getPeakMemoryUsage() : int { return array_reduce($this->executedStatements, function ($v, $s) { $m = $s->getEndMemory(); return $m > $v ? $m : $v; }) ?? 0; }
The text was updated successfully, but these errors were encountered:
Closed by #523
Sorry, something went wrong.
No branches or pull requests
Hello, I have discovered probably a problem.
Im using Laravel DebuBar and when I want to register
TraceablePDO
class to track all PDO queries and run 0 queries, it gives error with return type.Register (in Laravel ServiceProvider):
Error:
After preventing from returning null, it works as it should.
Fix (in
DebugBar\DataCollector\PDO\TraceablePDO
):The text was updated successfully, but these errors were encountered: