From 42760d0d7f56438712d786c627cb313604ac96dd Mon Sep 17 00:00:00 2001 From: Amrouche Hamza Date: Wed, 6 Dec 2017 07:29:51 +0100 Subject: [PATCH] [DoctrineBridge] DoctrineDataCollector comments the non runnable part of the query --- .../Bridge/Doctrine/DataCollector/DoctrineDataCollector.php | 6 +++--- .../Form/EventListener/MergeDoctrineCollectionListener.php | 2 +- .../Tests/DataCollector/DoctrineDataCollectorTest.php | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php index 62c6a2381a94..7f5a5105a7a8 100644 --- a/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php +++ b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php @@ -162,8 +162,8 @@ private function sanitizeParam($var) $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 @@ private function sanitizeParam($var) } 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); diff --git a/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php b/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php index 81ee5cf405ea..487523dd5dfe 100644 --- a/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php +++ b/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php @@ -45,7 +45,7 @@ public function onSubmit(FormEvent $event) // 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(); } } diff --git a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php index 8cbd2c3eacb3..add62ca58f2b 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php @@ -126,12 +126,12 @@ public function paramProvider() 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, ), );