Fix type error
This commit is contained in:
parent
57d73fcac3
commit
7b8ee3ece8
@ -138,6 +138,9 @@ class DoctrineDataCollector extends DataCollector
|
|||||||
if (!\is_array($query['params'])) {
|
if (!\is_array($query['params'])) {
|
||||||
$query['params'] = [$query['params']];
|
$query['params'] = [$query['params']];
|
||||||
}
|
}
|
||||||
|
if (!\is_array($query['types'])) {
|
||||||
|
$query['types'] = [];
|
||||||
|
}
|
||||||
foreach ($query['params'] as $j => $param) {
|
foreach ($query['params'] as $j => $param) {
|
||||||
if (isset($query['types'][$j])) {
|
if (isset($query['types'][$j])) {
|
||||||
// Transform the param according to the type
|
// Transform the param according to the type
|
||||||
|
@ -102,6 +102,18 @@ class DoctrineDataCollectorTest extends TestCase
|
|||||||
$this->assertTrue($collectedQueries['default'][1]['explainable']);
|
$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()
|
public function testReset()
|
||||||
{
|
{
|
||||||
$queries = [
|
$queries = [
|
||||||
|
Reference in New Issue
Block a user