Skip to content

Commit efc7e32

Browse files
committed
Merge branch '2.8' into 3.4
* 2.8: Improved variable naming
2 parents b0ac3f7 + 3ea8315 commit efc7e32

10 files changed

+24
-26
lines changed

best_practices/business-logic.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ looking for mapping information::
237237
*/
238238
class Post
239239
{
240-
const NUM_ITEMS = 10;
240+
const NUMBER_OF_ITEMS = 10;
241241

242242
/**
243243
* @ORM\Id

best_practices/templates.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ Markdown content into HTML::
9797

9898
public function toHtml($text)
9999
{
100-
$html = $this->parser->text($text);
101-
102-
return $html;
100+
return $this->parser->text($text);
103101
}
104102
}
105103

components/form.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ Your integration with the Validation component will look something like this::
309309
use Symfony\Component\Validator\Validation;
310310

311311
$vendorDirectory = realpath(__DIR__.'/../vendor');
312-
$vendorFormDirectory = $vendorDir.'/symfony/form';
312+
$vendorFormDirectory = $vendorDirectory.'/symfony/form';
313313
$vendorValidatorDirectory = $vendorDirectory.'/symfony/validator';
314314

315315
// creates the validator - details will vary

components/serializer.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -451,14 +451,14 @@ and :class:`Symfony\\Component\\Serializer\\Normalizer\\PropertyNormalizer`::
451451

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

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

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

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

controller/soap_web_service.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Below is an example calling the service using a `NuSOAP`_ client. This example
9999
assumes that the ``indexAction()`` in the controller above is accessible via the
100100
route ``/soap``::
101101

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

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

form/unit_testing.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,20 @@ make sure the ``FormRegistry`` uses the created instance::
129129

130130
class TestedTypeTest extends TypeTestCase
131131
{
132-
private $entityManager;
132+
private $objectManager;
133133

134134
protected function setUp()
135135
{
136136
// mock any dependencies
137-
$this->entityManager = $this->createMock(ObjectManager::class);
137+
$this->objectManager = $this->createMock(ObjectManager::class);
138138

139139
parent::setUp();
140140
}
141141

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

147147
return array(
148148
// register the type instances with the PreloadedExtension

routing/custom_route_loader.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ and configure the service and method to call:
9898
// app/config/routing.php
9999
use Symfony\Component\Routing\RouteCollection;
100100
101-
$collection = new RouteCollection();
102-
$collection->addCollection(
101+
$routes = new RouteCollection();
102+
$routes->addCollection(
103103
$loader->import("admin_route_loader:loadRoutes", "service")
104104
);
105105
106-
return $collection;
106+
return $routes;
107107
108108
In this example, the routes are loaded by calling the ``loadRoutes()`` method of
109109
the service whose ID is ``admin_route_loader``. Your service doesn't have to

security/custom_password_authenticator.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ the user::
5252
throw new CustomUserMessageAuthenticationException('Invalid username or password');
5353
}
5454

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

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

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

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

137137
This is a service that is already available in Symfony and it uses the password algorithm
138138
that is configured in the security configuration (e.g. ``security.yml``) under

security/expressions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ Additionally, you have access to a number of functions inside the expression:
7575
use Symfony\Component\ExpressionLanguage\Expression;
7676
// ...
7777

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

81-
$access2 = $ac->isGranted(new Expression(
81+
$access2 = $authorizationChecker->isGranted(new Expression(
8282
'is_remember_me() or is_fully_authenticated()'
8383
));
8484

security/guard_authentication.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ Customizing Error Messages
434434
--------------------------
435435

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

441441
But, you can easily return a custom message by throwing a

0 commit comments

Comments
 (0)