Skip to content

Commit

Permalink
minor #19624 [Bridge/Twig] Simplify dumping snippet (nicolas-grekas)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Bridge/Twig] Simplify dumping snippet

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | needs #19623
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

ef7122e [Bridge/Twig] Simplify dumping snippet
  • Loading branch information
fabpot committed Aug 16, 2016
2 parents 3bf89b6 + ef7122e commit cf30750
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions src/Symfony/Bridge/Twig/Extension/DumpExtension.php
Expand Up @@ -69,16 +69,11 @@ public function dump(\Twig_Environment $env, $context)
}

$dump = fopen('php://memory', 'r+b');
$prevOutput = $this->dumper->setOutput($dump);

foreach ($vars as $value) {
$this->dumper->dump($this->cloner->cloneVar($value));
$this->dumper->dump($this->cloner->cloneVar($value), $dump);
}

$this->dumper->setOutput($prevOutput);

rewind($dump);

return stream_get_contents($dump);
return stream_get_contents($dump, -1, 0);
}
}
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/composer.json
Expand Up @@ -33,7 +33,7 @@
"symfony/security-acl": "~2.8|~3.0",
"symfony/stopwatch": "~2.8|~3.0",
"symfony/console": "~2.8|~3.0",
"symfony/var-dumper": "~2.8.9|~3.0.9|~3.1.3|~3.2",
"symfony/var-dumper": "~2.8.10|~3.1.4|~3.2",
"symfony/expression-language": "~2.8|~3.0"
},
"suggest": {
Expand Down

0 comments on commit cf30750

Please sign in to comment.