for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Containers\Debugger\Tasks;
use App;
use DB;
use Illuminate\Support\Facades\Config;
use Log;
/**
* Class QueryDebuggerTask.
*
* @author Mahmoud Zalt <[email protected]>
*/
class QueryDebuggerTask
{
* Write the DB queries in the Log and Display them in the
* terminal (in case you want to see them while executing the tests).
* @param bool|false $terminal
$terminal
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
public function run()
$debuggerEnabled = Config::get('debugger.queries.debug');
if ($debuggerEnabled) {
$consoleOutputEnabled = Config::get('debugger.queries.output.console');
$logOutputEnabled = Config::get('debugger.queries.output.log');
DB::listen(function ($event) use ($consoleOutputEnabled, $logOutputEnabled) {
$fullQuery = vsprintf(str_replace(['%', '?'], ['%%', '%s'], $event->sql), $event->bindings);
$result = $event->connectionName . ' (' . $event->time . '): ' . $fullQuery;
if ($consoleOutputEnabled) {
dump($result);
}
if ($logOutputEnabled) {
Log::info($result);
});
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.