[DoctrineBridge] DoctrineDataCollector comments the non runnable part of the query

This commit is contained in:
Amrouche Hamza 2017-12-06 07:29:51 +01:00
parent 03af7b93ad
commit 42760d0d7f
No known key found for this signature in database
GPG Key ID: 6968F2785ED4F012
3 changed files with 7 additions and 7 deletions

View File

@ -162,8 +162,8 @@ class DoctrineDataCollector extends DataCollector
$className = get_class($var);
return method_exists($var, '__toString') ?
array(sprintf('Object(%s): "%s"', $className, $var->__toString()), false) :
array(sprintf('Object(%s)', $className), false);
array(sprintf('/* Object(%s): */"%s"', $className, $var->__toString()), false) :
array(sprintf('/* Object(%s) */', $className), false);
}
if (is_array($var)) {
@ -179,7 +179,7 @@ class DoctrineDataCollector extends DataCollector
}
if (is_resource($var)) {
return array(sprintf('Resource(%s)', get_resource_type($var)), false);
return array(sprintf('/* Resource(%s) */', get_resource_type($var)), false);
}
return array($var, true);

View File

@ -45,7 +45,7 @@ class MergeDoctrineCollectionListener implements EventSubscriberInterface
// If all items were removed, call clear which has a higher
// performance on persistent collections
if ($collection instanceof Collection && count($data) === 0) {
if ($collection instanceof Collection && 0 === count($data)) {
$collection->clear();
}
}

View File

@ -126,12 +126,12 @@ class DoctrineDataCollectorTest extends TestCase
array(true, array(), true, true),
array(null, array(), null, true),
array(new \DateTime('2011-09-11'), array('date'), '2011-09-11', true),
array(fopen(__FILE__, 'r'), array(), 'Resource(stream)', false),
array(new \stdClass(), array(), 'Object(stdClass)', false),
array(fopen(__FILE__, 'r'), array(), '/* Resource(stream) */', false),
array(new \stdClass(), array(), '/* Object(stdClass) */', false),
array(
new StringRepresentableClass(),
array(),
'Object(Symfony\Bridge\Doctrine\Tests\DataCollector\StringRepresentableClass): "string representation"',
'/* Object(Symfony\Bridge\Doctrine\Tests\DataCollector\StringRepresentableClass): */"string representation"',
false,
),
);