Fix type error

This commit is contained in:
Tomas 2019-06-25 10:30:09 +03:00
parent 57d73fcac3
commit 7b8ee3ece8
2 changed files with 15 additions and 0 deletions

View File

@ -138,6 +138,9 @@ class DoctrineDataCollector extends DataCollector
if (!\is_array($query['params'])) {
$query['params'] = [$query['params']];
}
if (!\is_array($query['types'])) {
$query['types'] = [];
}
foreach ($query['params'] as $j => $param) {
if (isset($query['types'][$j])) {
// Transform the param according to the type

View File

@ -102,6 +102,18 @@ class DoctrineDataCollectorTest extends TestCase
$this->assertTrue($collectedQueries['default'][1]['explainable']);
}
public function testCollectQueryWithNoTypes()
{
$queries = [
['sql' => 'SET sql_mode=(SELECT REPLACE(@@sql_mode, \'ONLY_FULL_GROUP_BY\', \'\'))', 'params' => [], 'types' => null, 'executionMS' => 1],
];
$c = $this->createCollector($queries);
$c->collect(new Request(), new Response());
$collectedQueries = $c->getQueries();
$this->assertSame([], $collectedQueries['default'][0]['types']);
}
public function testReset()
{
$queries = [