Skip to content

fixed cs of php parts #1497

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 6 commits into from
Closed
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ a controller object. Controllers are also called *actions*.
:linenos:

// src/Acme/HelloBundle/Controller/HelloController.php

namespace Acme\HelloBundle\Controller;

use Symfony\Component\HttpFoundation\Response;

class HelloController
Expand Down Expand Up @@ -208,8 +208,8 @@ passed to that method:

<?php
// src/Acme/HelloBundle/Controller/HelloController.php

namespace Acme\HelloBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class HelloController extends Controller
Expand Down Expand Up @@ -349,8 +349,8 @@ Add the ``use`` statement atop the ``Controller`` class and then modify the
.. code-block:: php

// src/Acme/HelloBundle/Controller/HelloController.php

namespace Acme\HelloBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;

Expand Down
8 changes: 4 additions & 4 deletions book/doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Without even thinking about Doctrine or databases, you already know that
you need a ``Product`` object to represent those products. Create this class
inside the ``Entity`` directory of your ``AcmeStoreBundle``::

// src/Acme/StoreBundle/Entity/Product.php
// src/Acme/StoreBundle/Entity/Product.php
namespace Acme\StoreBundle\Entity;

class Product
Expand Down Expand Up @@ -369,7 +369,7 @@ of the bundle:
use Acme\StoreBundle\Entity\Product;
use Symfony\Component\HttpFoundation\Response;
// ...

public function createAction()
{
$product = new Product();
Expand Down Expand Up @@ -1058,7 +1058,7 @@ can avoid the second query by issuing a join in the original query. Add the
following method to the ``ProductRepository`` class::

// src/Acme/StoreBundle/Repository/ProductRepository.php

public function findOneByIdJoinedToCategory($id)
{
$query = $this->getManager()
Expand All @@ -1067,7 +1067,7 @@ following method to the ``ProductRepository`` class::
JOIN p.category c
WHERE p.id = :id'
)->setParameter('id', $id);

try {
return $query->getSingleResult();
} catch (\Doctrine\ORM\NoResultException $e) {
Expand Down
1 change: 0 additions & 1 deletion book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,6 @@ that will house the logic for building the task form:
.. code-block:: php

// src/Acme/TaskBundle/Form/Type/TaskType.php

namespace Acme\TaskBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
Expand Down
2 changes: 1 addition & 1 deletion book/from_flat_php_to_symfony2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ them for you. Here's the same sample application, now built in Symfony2:

<?php
// src/Acme/BlogBundle/Controller/BlogController.php

namespace Acme\BlogBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class BlogController extends Controller
Expand Down
8 changes: 4 additions & 4 deletions book/page_creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ greeted. To create the page, follow the simple two-step process.
``web`` directory of your new Symfony2 project. For detailed information
on this process, see the documentation on the web server you are using.
Here's the relevant documentation page for some web server you might be using:

* For Apache HTTP Server, refer to `Apache's DirectoryIndex documentation`_.
* For Nginx, refer to `Nginx HttpCoreModule location documentation`_.

Expand Down Expand Up @@ -209,8 +209,6 @@ inside your ``AcmeHelloBundle``::
// src/Acme/HelloBundle/Controller/HelloController.php
namespace Acme\HelloBundle\Controller;

use Symfony\Component\HttpFoundation\Response;

class HelloController
Copy link
Member

Choose a reason for hiding this comment

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

This must be reverted, because it is used in the next code block (and this code is included there because of the ...).

Or, maybe better, place this line in the next code block. I think that's the best option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wouterj done thank you ;)

{
}
Expand All @@ -225,8 +223,10 @@ Create the ``indexAction`` method that Symfony will execute when the ``hello``
route is matched::

// src/Acme/HelloBundle/Controller/HelloController.php
namespace Acme\HelloBundle\Controller;

use Symfony\Component\HttpFoundation\Response;

// ...
class HelloController
{
public function indexAction($name)
Expand Down
4 changes: 2 additions & 2 deletions book/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ pattern that points to a specific PHP class and method:
.. code-block:: php

// src/Acme/BlogBundle/Controller/BlogController.php

namespace Acme\BlogBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class BlogController extends Controller
Expand Down Expand Up @@ -825,8 +825,8 @@ The controller might look like this:
.. code-block:: php

// src/Acme/BlogBundle/Controller/BlogController.php

namespace Acme\BlogBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class BlogController extends Controller
Expand Down
2 changes: 1 addition & 1 deletion book/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ called ``Calculator`` in the ``Utility/`` directory of your bundle::

// src/Acme/DemoBundle/Utility/Calculator.php
namespace Acme\DemoBundle\Utility;

class Calculator
{
public function add($a, $b)
Expand Down
4 changes: 2 additions & 2 deletions cookbook/bundles/inheritance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ original method, and change its functionality::
public function registerAction()
{
$response = parent::registerAction();

// do custom stuff

return $response;
}
}
Expand Down
6 changes: 3 additions & 3 deletions cookbook/doctrine/event_listeners_subscribers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,17 @@ a ``postPersist`` method, which will be called when the event is thrown::

// src/Acme/SearchBundle/Listener/SearchIndexer.php
namespace Acme\SearchBundle\Listener;

use Doctrine\ORM\Event\LifecycleEventArgs;
use Acme\StoreBundle\Entity\Product;

class SearchIndexer
{
public function postPersist(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
$entityManager = $args->getEntityManager();

// perhaps you only want to act on some "Product" entity
if ($entity instanceof Product) {
// do something with the Product
Expand Down
6 changes: 3 additions & 3 deletions cookbook/form/create_custom_field_type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ will be called `GenderType` and the file will be stored in the default location
for form fields, which is ``<BundleName>\Form\Type``. Make sure the field extends
:class:`Symfony\\Component\\Form\\AbstractType`::

# src/Acme/DemoBundle/Form/Type/GenderType.php
// src/Acme/DemoBundle/Form/Type/GenderType.php
namespace Acme\DemoBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
Expand Down Expand Up @@ -153,7 +153,7 @@ new instance of the type in one of your forms::

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class AuthorType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
Expand Down Expand Up @@ -231,7 +231,7 @@ returned by the ``getName`` method defined earlier. We'll see the importance
of this in a moment when we use the custom field type. But first, add a ``__construct``
argument to ``GenderType``, which receives the gender configuration::

# src/Acme/DemoBundle/Form/Type/GenderType.php
// src/Acme/DemoBundle/Form/Type/GenderType.php
namespace Acme\DemoBundle\Form\Type;

use Symfony\Component\OptionsResolver\OptionsResolverInterface;
Expand Down
3 changes: 0 additions & 3 deletions cookbook/form/data_transformers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ was entered::

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Acme\TaskBundle\Form\DataTransformer\IssueToNumberTransformer;
use Doctrine\Common\Persistence\ObjectManager;

Expand Down Expand Up @@ -96,7 +95,6 @@ was entered::
Next, we create the data transformer, which does the actual conversion::

// src/Acme/TaskBundle/Form/DataTransformer/IssueToNumberTransformer.php

namespace Acme\TaskBundle\Form\DataTransformer;

use Symfony\Component\Form\DataTransformerInterface;
Expand Down Expand Up @@ -188,7 +186,6 @@ manager can be automatically injected:
You can now add the type to your form by its alias as follows::

// src/Acme/TaskBundle/Form/Type/TaskType.php

namespace Acme\TaskBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
Expand Down
12 changes: 6 additions & 6 deletions cookbook/form/dynamic_form_generation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ might look like the following::
class AddNameFieldSubscriber implements EventSubscriberInterface
{
private $factory;

public function __construct(FormFactoryInterface $factory)
{
$this->factory = $factory;
}

public static function getSubscribedEvents()
{
// Tells the dispatcher that we want to listen on the form.pre_set_data
Expand All @@ -116,11 +116,11 @@ might look like the following::
{
$data = $event->getData();
$form = $event->getForm();
// During form creation setData() is called with null as an argument
// by the FormBuilder constructor. We're only concerned with when

// During form creation setData() is called with null as an argument
// by the FormBuilder constructor. We're only concerned with when
// setData is called with an actual Entity object in it (whether new,
// or fetched with Doctrine). This if statement let's us skip right
// or fetched with Doctrine). This if statement let's us skip right
// over the null condition.
if (null === $data) {
return;
Expand Down
20 changes: 10 additions & 10 deletions cookbook/form/form_collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ objects. Start by creating a simple ``Task`` class::

// src/Acme/TaskBundle/Entity/Task.php
namespace Acme\TaskBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;

class Task
Expand All @@ -37,7 +37,7 @@ objects. Start by creating a simple ``Task`` class::
{
$this->tags = new ArrayCollection();
}

public function getDescription()
{
return $this->description;
Expand Down Expand Up @@ -151,19 +151,19 @@ In your controller, you'll now initialize a new instance of ``TaskType``::

// src/Acme/TaskBundle/Controller/TaskController.php
namespace Acme\TaskBundle\Controller;

use Acme\TaskBundle\Entity\Task;
use Acme\TaskBundle\Entity\Tag;
use Acme\TaskBundle\Form\Type\TaskType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class TaskController extends Controller
{
public function newAction(Request $request)
{
$task = new Task();

// dummy code - this is here just so that the Task has some tags
// otherwise, this isn't an interesting example
$tag1 = new Tag();
Expand All @@ -173,17 +173,17 @@ In your controller, you'll now initialize a new instance of ``TaskType``::
$tag2->name = 'tag2';
$task->getTags()->add($tag2);
// end dummy code

$form = $this->createForm(new TaskType(), $task);

// process the form on POST
if ('POST' === $request->getMethod()) {
$form->bindRequest($request);
if ($form->isValid()) {
// maybe do some form processing, like saving the Task and Tag objects
}
}

return $this->render('AcmeTaskBundle:Task:new.html.twig', array(
'form' => $form->createView(),
));
Expand Down Expand Up @@ -282,7 +282,7 @@ add the ``allow_add`` option to our collection field::

// src/Acme/TaskBundle/Form/Type/TaskType.php
// ...

use Symfony\Component\Form\FormBuilderInterface;

public function buildForm(FormBuilderInterface $builder, array $options)
Expand Down Expand Up @@ -499,7 +499,7 @@ Start by adding the ``allow_delete`` option in the form Type::
// src/Acme/TaskBundle/Form/Type/TaskType.php
// ...
use Symfony\Component\Form\FormBuilderInterface;

public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('description');
Expand Down
2 changes: 1 addition & 1 deletion cookbook/form/use_virtuals_forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ For example, imagine you have two entities, a ``Company`` and a ``Customer``::

.. code-block:: php

// src/Acme/HelloBundle/Entity/Company.php
// src/Acme/HelloBundle/Entity/Customer.php
namespace Acme\HelloBundle\Entity;

class Customer
Expand Down
8 changes: 4 additions & 4 deletions cookbook/security/custom_authentication_provider.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ provider.
public $created;
public $digest;
public $nonce;

public function __construct(array $roles = array())
{
parent::__construct($roles);

// If the user has roles, consider it authenticated
$this->setAuthenticated(count($roles) > 0);
}
Expand Down Expand Up @@ -141,7 +141,7 @@ set an authenticated token in the security context if successful.

if ($returnValue instanceof TokenInterface) {
return $this->securityContext->setToken($returnValue);
} else if ($returnValue instanceof Response) {
} elseif ($returnValue instanceof Response) {
return $event->setResponse($returnValue);
}
} catch (AuthenticationException $e) {
Expand Down Expand Up @@ -208,7 +208,7 @@ the ``PasswordDigest`` header value matches with the user's password.
{
$user = $this->userProvider->loadUserByUsername($token->getUsername());

if ($user && $this->validateDigest($token->digest, $token->nonce, $token->created, $user->getPassword())) {
if ($user && $this->validateDigest($token->digest, $token->nonce, $token->created, $user->getPassword())) {
$authenticatedToken = new WsseUserToken($user->getRoles());
$authenticatedToken->setUser($user);

Expand Down
Loading