Skip to content

Commit f4f07b4

Browse files
committed
minor #675 Tweaked the way dump() function is explained (javiereguiluz)
This PR was merged into the master branch. Discussion ---------- Tweaked the way dump() function is explained I don't like how `dump()` is explained. Some newcomers may think that you need to do the `if ('dev' === $this->getParameter('kernel.environment')) {` check yourself when using this function. I propose to change it like this pull request ... or even remove it entirely. Thoughts? Commits ------- b226df7 Tweaked the way dump() function is explained
2 parents cfa6887 + b226df7 commit f4f07b4

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/Controller/BlogController.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,12 @@ public function indexAction(int $page, string $_format): Response
6969
*/
7070
public function postShowAction(Post $post): Response
7171
{
72-
// Symfony provides a function called 'dump()' which is an improved version
73-
// of the 'var_dump()' function. It's useful to quickly debug the contents
74-
// of any variable, but it's not available in the 'prod' environment to
75-
// prevent any leak of sensitive information.
76-
// This function can be used both in PHP files and Twig templates. The only
77-
// requirement is to have enabled the DebugBundle.
78-
if ('dev' === $this->getParameter('kernel.environment')) {
79-
dump($post, $this->getUser(), new \DateTime());
80-
}
72+
// Symfony's 'dump()' function is an improved version of PHP's 'var_dump()' but
73+
// it's not available in the 'prod' environment to prevent leaking sensitive information.
74+
// It can be used both in PHP files and Twig templates, but it requires to
75+
// have enabled the DebugBundle. Uncomment the following line to see it in action:
76+
//
77+
// dump($post, $this->getUser(), new \DateTime());
8178

8279
return $this->render('blog/post_show.html.twig', ['post' => $post]);
8380
}

0 commit comments

Comments
 (0)