Skip to content

remove else and parenthesis unneeded #2884

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 1 commit 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
10 changes: 4 additions & 6 deletions book/validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ simple example from inside a controller::

if (count($errors) > 0) {
return new Response(print_r($errors, true));
} else {
return new Response('The author is valid! Yes!');
}

return new Response('The author is valid! Yes!');
}

If the ``$name`` property is empty, you will see the following error
Expand Down Expand Up @@ -161,9 +161,7 @@ You could also pass the collection of errors into a template.
return $this->render('AcmeBlogBundle:Author:validate.html.twig', array(
'errors' => $errors,
));
} else {
// ...
}
}

Inside the template, you can output the list of errors exactly as needed:

Expand Down Expand Up @@ -633,7 +631,7 @@ Now, create the ``isPasswordLegal()`` method, and include the logic you need::

public function isPasswordLegal()
{
return ($this->firstName != $this->password);
return $this->firstName != $this->password;
}

.. note::
Expand Down