Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit db816ed

Browse files
committed
feature #25346 [DoctrineBridge] DoctrineDataCollector comments the non runnable part of the query (Simperfit)
This PR was merged into the 4.1-dev branch. Discussion ---------- [DoctrineBridge] DoctrineDataCollector comments the non runnable part of the query | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | yes | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | #24782 | License | MIT | Doc PR | symfony/symfony-docs#... <!--highly recommended for new features--> ![img_2932](https://user-images.githubusercontent.com/3451634/33648180-f6c7a5ac-da58-11e7-8bf8-95fc943d16ff.jpeg) I think the idea in this ticket is good and it should be implemented. Could we go further by adding more things to this feature, or will it be ok to just comment out the un-needed part to make the kiri ![kiri](https://user-images.githubusercontent.com/3451634/33648278-5eccc830-da59-11e7-8034-a1b9efee7673.png) (french joke for query) runnable ? Commits ------- 42760d0 [DoctrineBridge] DoctrineDataCollector comments the non runnable part of the query
2 parents d220e28 + 42760d0 commit db816ed

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ private function sanitizeParam($var): array
172172
$className = get_class($var);
173173

174174
return method_exists($var, '__toString') ?
175-
array(sprintf('Object(%s): "%s"', $className, $var->__toString()), false) :
176-
array(sprintf('Object(%s)', $className), false);
175+
array(sprintf('/* Object(%s): */"%s"', $className, $var->__toString()), false) :
176+
array(sprintf('/* Object(%s) */', $className), false);
177177
}
178178

179179
if (is_array($var)) {
@@ -189,7 +189,7 @@ private function sanitizeParam($var): array
189189
}
190190

191191
if (is_resource($var)) {
192-
return array(sprintf('Resource(%s)', get_resource_type($var)), false);
192+
return array(sprintf('/* Resource(%s) */', get_resource_type($var)), false);
193193
}
194194

195195
return array($var, true);

src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ public function paramProvider()
140140
array(true, array(), true, true),
141141
array(null, array(), null, true),
142142
array(new \DateTime('2011-09-11'), array('date'), '2011-09-11', true),
143-
array(fopen(__FILE__, 'r'), array(), 'Resource(stream)', false),
144-
array(new \stdClass(), array(), 'Object(stdClass)', false),
143+
array(fopen(__FILE__, 'r'), array(), '/* Resource(stream) */', false),
144+
array(new \stdClass(), array(), '/* Object(stdClass) */', false),
145145
array(
146146
new StringRepresentableClass(),
147147
array(),
148-
'Object(Symfony\Bridge\Doctrine\Tests\DataCollector\StringRepresentableClass): "string representation"',
148+
'/* Object(Symfony\Bridge\Doctrine\Tests\DataCollector\StringRepresentableClass): */"string representation"',
149149
false,
150150
),
151151
);

0 commit comments

Comments
 (0)