Skip to content

Commit

Permalink
Merge branch '2.8' into 3.4
Browse files Browse the repository at this point in the history
* 2.8:
  Improved variable naming
  • Loading branch information
javiereguiluz committed Mar 12, 2018
2 parents b0ac3f7 + 3ea8315 commit efc7e32
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion best_practices/business-logic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ looking for mapping information::
*/
class Post
{
const NUM_ITEMS = 10;
const NUMBER_OF_ITEMS = 10;

/**
* @ORM\Id
Expand Down
4 changes: 1 addition & 3 deletions best_practices/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ Markdown content into HTML::

public function toHtml($text)
{
$html = $this->parser->text($text);

return $html;
return $this->parser->text($text);
}
}

Expand Down
2 changes: 1 addition & 1 deletion components/form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ Your integration with the Validation component will look something like this::
use Symfony\Component\Validator\Validation;

$vendorDirectory = realpath(__DIR__.'/../vendor');
$vendorFormDirectory = $vendorDir.'/symfony/form';
$vendorFormDirectory = $vendorDirectory.'/symfony/form';
$vendorValidatorDirectory = $vendorDirectory.'/symfony/validator';

// creates the validator - details will vary
Expand Down
12 changes: 6 additions & 6 deletions components/serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -451,14 +451,14 @@ and :class:`Symfony\\Component\\Serializer\\Normalizer\\PropertyNormalizer`::

$serializer = new Serializer(array($normalizer), array(new JsonEncoder()));

$obj = new Company();
$obj->name = 'Acme Inc.';
$obj->address = '123 Main Street, Big City';
$company = new Company();
$company->name = 'Acme Inc.';
$company->address = '123 Main Street, Big City';

$json = $serializer->serialize($obj, 'json');
$json = $serializer->serialize($company, 'json');
// {"org_name": "Acme Inc.", "org_address": "123 Main Street, Big City"}
$objCopy = $serializer->deserialize($json, Company::class, 'json');
// Same data as $obj
$companyCopy = $serializer->deserialize($json, Company::class, 'json');
// Same data as $company

.. _using-camelized-method-names-for-underscored-attributes:

Expand Down
2 changes: 1 addition & 1 deletion controller/soap_web_service.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Below is an example calling the service using a `NuSOAP`_ client. This example
assumes that the ``indexAction()`` in the controller above is accessible via the
route ``/soap``::

$soapClient = new \Soapclient('http://example.com/app.php/soap?wsdl');
$soapClient = new \SoapClient('http://example.com/app.php/soap?wsdl');

$result = $soapClient->call('hello', array('name' => 'Scott'));

Expand Down
6 changes: 3 additions & 3 deletions form/unit_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,20 @@ make sure the ``FormRegistry`` uses the created instance::

class TestedTypeTest extends TypeTestCase
{
private $entityManager;
private $objectManager;

protected function setUp()
{
// mock any dependencies
$this->entityManager = $this->createMock(ObjectManager::class);
$this->objectManager = $this->createMock(ObjectManager::class);

parent::setUp();
}

protected function getExtensions()
{
// create a type instance with the mocked dependencies
$type = new TestedType($this->entityManager);
$type = new TestedType($this->objectManager);

return array(
// register the type instances with the PreloadedExtension
Expand Down
6 changes: 3 additions & 3 deletions routing/custom_route_loader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ and configure the service and method to call:
// app/config/routing.php
use Symfony\Component\Routing\RouteCollection;
$collection = new RouteCollection();
$collection->addCollection(
$routes = new RouteCollection();
$routes->addCollection(
$loader->import("admin_route_loader:loadRoutes", "service")
);
return $collection;
return $routes;
In this example, the routes are loaded by calling the ``loadRoutes()`` method of
the service whose ID is ``admin_route_loader``. Your service doesn't have to
Expand Down
6 changes: 3 additions & 3 deletions security/custom_password_authenticator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ the user::
throw new CustomUserMessageAuthenticationException('Invalid username or password');
}

$passwordValid = $this->encoder->isPasswordValid($user, $token->getCredentials());
$isPasswordValid = $this->encoder->isPasswordValid($user, $token->getCredentials());

if ($passwordValid) {
if ($isPasswordValid) {
$currentHour = date('G');
if ($currentHour < 14 || $currentHour > 16) {
// CAUTION: this message will be returned to the client
Expand Down Expand Up @@ -132,7 +132,7 @@ inside of it.

Inside this method, the password encoder is needed to check the password's validity::

$passwordValid = $this->encoder->isPasswordValid($user, $token->getCredentials());
$isPasswordValid = $this->encoder->isPasswordValid($user, $token->getCredentials());

This is a service that is already available in Symfony and it uses the password algorithm
that is configured in the security configuration (e.g. ``security.yml``) under
Expand Down
6 changes: 3 additions & 3 deletions security/expressions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ Additionally, you have access to a number of functions inside the expression:
use Symfony\Component\ExpressionLanguage\Expression;
// ...

$ac = $this->get('security.authorization_checker');
$access1 = $ac->isGranted('IS_AUTHENTICATED_REMEMBERED');
$authorizationChecker = $this->get('security.authorization_checker');
$access1 = $authorizationChecker->isGranted('IS_AUTHENTICATED_REMEMBERED');

$access2 = $ac->isGranted(new Expression(
$access2 = $authorizationChecker->isGranted(new Expression(
'is_remember_me() or is_fully_authenticated()'
));

Expand Down
4 changes: 2 additions & 2 deletions security/guard_authentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ Customizing Error Messages
--------------------------

When ``onAuthenticationFailure()`` is called, it is passed an ``AuthenticationException``
that describes *how* authentication failed via its ``$e->getMessageKey()`` (and
``$e->getMessageData()``) method. The message will be different based on *where*
that describes *how* authentication failed via its ``$exception->getMessageKey()`` (and
``$exception->getMessageData()``) method. The message will be different based on *where*
authentication fails (i.e. ``getUser()`` versus ``checkCredentials()``).

But, you can easily return a custom message by throwing a
Expand Down

0 comments on commit efc7e32

Please sign in to comment.