Skip to content

Commit

Permalink
feature #25346 [DoctrineBridge] DoctrineDataCollector comments the no…
Browse files Browse the repository at this point in the history
…n 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
-------

42760d0d7f [DoctrineBridge] DoctrineDataCollector comments the non runnable part of the query
  • Loading branch information
fabpot committed Dec 7, 2017
2 parents 31690d8 + e09f8ef commit e5e7f4d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions DataCollector/DoctrineDataCollector.php
Expand Up @@ -172,8 +172,8 @@ private function sanitizeParam($var): array
$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)) {
Expand All @@ -189,7 +189,7 @@ private function sanitizeParam($var): array
}

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);
Expand Down
6 changes: 3 additions & 3 deletions Tests/DataCollector/DoctrineDataCollectorTest.php
Expand Up @@ -140,12 +140,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,
),
);
Expand Down

0 comments on commit e5e7f4d

Please sign in to comment.