Skip to content

Documentation: add missing php tags / "use" statements #8324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion page_creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ random) number and prints it. To do that, create a "Controller class" and a
"controller" method inside of it that will be executed when someone goes to
``/lucky/number``::

<?php
// src/AppBundle/Controller/LuckyController.php
namespace AppBundle\Controller;

Expand Down Expand Up @@ -116,9 +117,14 @@ First, make sure that ``LuckyController`` extends Symfony's base
Now, use the handy ``render()`` function to render a template. Pass it our ``number``
variable so we can render that::

<?php
// src/AppBundle/Controller/LuckyController.php
namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

// ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use this placeholder comment in many places to indicate that the code example is not complete. This is usually done when the code evolves during the reader following an article down from the top. We then just try to add what is new for this specific example.

In this file, the LuckyController class was already introduced before (in the other code example that you changed) including the needed namespace and use statements.

Furthermore, we omit the opening <?php tags everywhere for brevity to keep all code examples as small as possible.

Thus, for me there is nothing to change here. Anyway, thank you very much for opening this PR. We really appreciate people coming with feedback and trying to improve the docs.

class LuckyController extends Controller
{
/**
Expand Down