Skip to content

Commit 51ddf41

Browse files
committed
improve naming
1 parent efc7e32 commit 51ddf41

15 files changed

+68
-68
lines changed

components/cache.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,43 +63,43 @@ instantiate :class:`Symfony\\Component\\Cache\\Simple\\FilesystemCache`::
6363
Now you can create, retrieve, update and delete items using this object::
6464

6565
// save a new item in the cache
66-
$cache->set('stats.num_products', 4711);
66+
$cache->set('stats.products_count', 4711);
6767

6868
// or set it with a custom ttl
69-
// $cache->set('stats.num_products', 4711, 3600);
69+
// $cache->set('stats.products_count', 4711, 3600);
7070

7171
// retrieve the cache item
72-
if (!$cache->has('stats.num_products')) {
72+
if (!$cache->has('stats.products_count')) {
7373
// ... item does not exists in the cache
7474
}
7575

7676
// retrieve the value stored by the item
77-
$numProducts = $cache->get('stats.num_products');
77+
$productsCount = $cache->get('stats.products_count');
7878

7979
// or specify a default value, if the key doesn't exist
80-
// $numProducts = $cache->get('stats.num_products', 100);
80+
// $productsCount = $cache->get('stats.products_count', 100);
8181

8282
// remove the cache key
83-
$cache->delete('stats.num_products');
83+
$cache->delete('stats.products_count');
8484

8585
// clear *all* cache keys
8686
$cache->clear();
8787

8888
You can also work with multiple items at once::
8989

9090
$cache->setMultiple(array(
91-
'stats.num_products' => 4711,
92-
'stats.num_users' => 1356,
91+
'stats.products_count' => 4711,
92+
'stats.users_count' => 1356,
9393
));
9494

9595
$stats = $cache->getMultiple(array(
96-
'stats.num_products',
97-
'stats.num_users',
96+
'stats.products_count',
97+
'stats.users_count',
9898
));
9999

100100
$cache->deleteMultiple(array(
101-
'stats.num_products',
102-
'stats.num_users',
101+
'stats.products_count',
102+
'stats.users_count',
103103
));
104104

105105
Available Simple Cache (PSR-16) Classes
@@ -162,22 +162,22 @@ a filesystem-based cache, instantiate :class:`Symfony\\Component\\Cache\\Adapter
162162
Now you can create, retrieve, update and delete items using this cache pool::
163163

164164
// create a new item by trying to get it from the cache
165-
$numProducts = $cache->getItem('stats.num_products');
165+
$productsCount = $cache->getItem('stats.products_count');
166166

167167
// assign a value to the item and save it
168-
$numProducts->set(4711);
169-
$cache->save($numProducts);
168+
$productsCount->set(4711);
169+
$cache->save($productsCount);
170170

171171
// retrieve the cache item
172-
$numProducts = $cache->getItem('stats.num_products');
173-
if (!$numProducts->isHit()) {
172+
$productsCount = $cache->getItem('stats.products_count');
173+
if (!$productsCount->isHit()) {
174174
// ... item does not exists in the cache
175175
}
176176
// retrieve the value stored by the item
177-
$total = $numProducts->get();
177+
$total = $productsCount->get();
178178

179179
// remove the cache item
180-
$cache->deleteItem('stats.num_products');
180+
$cache->deleteItem('stats.products_count');
181181

182182
For a list of all of the supported adapters, see :doc:`/components/cache/cache_pools`.
183183

components/cache/adapters/doctrine_adapter.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ third parameters::
2020

2121
$provider = new SQLite3Cache(new \SQLite3(__DIR__.'/cache/data.sqlite'), 'youTableName');
2222

23-
$symfonyCache = new DoctrineAdapter(
23+
$cache = new DoctrineAdapter(
2424

2525
// a cache provider instance
2626
CacheProvider $provider,

components/cache/adapters/php_array_cache_adapter.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ that is optimized and preloaded into OPcache memory storage::
1515
if ($needsWarmup) {
1616
// some static values
1717
$values = array(
18-
'stats.num_products' => 4711,
19-
'stats.num_users' => 1356,
18+
'stats.products_count' => 4711,
19+
'stats.users_count' => 1356,
2020
);
2121

2222
$cache = new PhpArrayAdapter(
@@ -29,7 +29,7 @@ that is optimized and preloaded into OPcache memory storage::
2929
}
3030

3131
// ... then, use the cache!
32-
$cacheItem = $cache->getItem('stats.num_users');
32+
$cacheItem = $cache->getItem('stats.users_count');
3333
echo $cacheItem->get();
3434

3535
.. note::

components/cache/cache_items.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ Cache items are created with the ``getItem($key)`` method of the cache pool. The
3131
argument is the key of the item::
3232

3333
// $cache pool object was created before
34-
$numProducts = $cache->getItem('stats.num_products');
34+
$productsCount = $cache->getItem('stats.products_count');
3535

3636
Then, use the :method:`Psr\\Cache\\CacheItemInterface::set` method to set
3737
the data stored in the cache item::
3838

3939
// storing a simple integer
40-
$numProducts->set(4711);
41-
$cache->save($numProducts);
40+
$productsCount->set(4711);
41+
$cache->save($productsCount);
4242

4343
// storing an array
44-
$numProducts->set(array(
44+
$productsCount->set(array(
4545
'category1' => 4711,
4646
'category2' => 2387,
4747
));
48-
$cache->save($numProducts);
48+
$cache->save($productsCount);
4949

5050
The key and the value of any given cache item can be obtained with the
5151
corresponding *getter* methods::

components/filesystem.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ The :method:`Symfony\\Component\\Filesystem\\Filesystem::readlink` method provid
225225
by the Filesystem component always behaves in the same way::
226226

227227
// returns the next direct target of the link without considering the existence of the target
228-
$fs->readlink('/path/to/link');
228+
$fileSystem->readlink('/path/to/link');
229229

230230
// returns its absolute fully resolved final version of the target (if there are nested links, they are resolved)
231-
$fs->readlink('/path/to/link', true);
231+
$fileSystem->readlink('/path/to/link', true);
232232

233233
Its behavior is the following::
234234

@@ -304,7 +304,7 @@ appendToFile
304304
:method:`Symfony\\Component\\Filesystem\\Filesystem::appendToFile` adds new
305305
contents at the end of some file::
306306

307-
$fs->appendToFile('logs.txt', 'Email sent to user@example.com');
307+
$fileSystem->appendToFile('logs.txt', 'Email sent to user@example.com');
308308

309309
If either the file or its containing directory doesn't exist, this method
310310
creates them before appending the contents.

components/ldap.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,19 @@ delete existing ones::
118118
'objectClass' => array('inetOrgPerson'),
119119
));
120120

121-
$em = $ldap->getEntryManager();
121+
$entityManager = $ldap->getEntryManager();
122122

123123
// Creating a new entry
124-
$em->add($entry);
124+
$entityManager->add($entry);
125125

126126
// Finding and updating an existing entry
127127
$query = $ldap->query('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))');
128128
$result = $query->execute();
129129
$entry = $result[0];
130130
$entry->setAttribute('email', array('fabpot@symfony.com'));
131-
$em->update($entry);
131+
$entityManager->update($entry);
132132

133133
// Removing an existing entry
134-
$em->remove(new Entry('cn=Test User,dc=symfony,dc=com'));
134+
$entityManager->remove(new Entry('cn=Test User,dc=symfony,dc=com'));
135135

136136
.. _Packagist: https://packagist.org/packages/symfony/ldap

components/routing.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ routes with UTF-8 characters:
413413
use Symfony\Component\Routing\RouteCollection;
414414
use Symfony\Component\Routing\Route;
415415
416-
$collection = new RouteCollection();
417-
$collection->add('route1', new Route('/category/{name}',
416+
$routes = new RouteCollection();
417+
$routes->add('route1', new Route('/category/{name}',
418418
array(
419419
'_controller' => 'AppBundle:Default:category',
420420
),
@@ -426,7 +426,7 @@ routes with UTF-8 characters:
426426
427427
// ...
428428
429-
return $collection;
429+
return $routes;
430430
431431
In this route, the ``utf8`` option set to ``true`` makes Symfony consider the
432432
``.`` requirement to match any UTF-8 characters instead of just a single
@@ -494,8 +494,8 @@ You can also include UTF-8 strings as routing requirements:
494494
use Symfony\Component\Routing\RouteCollection;
495495
use Symfony\Component\Routing\Route;
496496
497-
$collection = new RouteCollection();
498-
$collection->add('route2', new Route('/default/{default}',
497+
$routes = new RouteCollection();
498+
$routes->add('route2', new Route('/default/{default}',
499499
array(
500500
'_controller' => 'AppBundle:Default:default',
501501
),
@@ -509,7 +509,7 @@ You can also include UTF-8 strings as routing requirements:
509509
510510
// ...
511511
512-
return $collection;
512+
return $routes;
513513
514514
.. tip::
515515

console/lazy_commands.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ with command names as keys and service identifiers as values::
7171
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
7272
use Symfony\Component\DependencyInjection\ContainerBuilder;
7373

74-
$container = new ContainerBuilder();
75-
$container->register(FooCommand::class, FooCommand::class);
76-
$container->compile();
74+
$containerBuilder = new ContainerBuilder();
75+
$containerBuilder->register(FooCommand::class, FooCommand::class);
76+
$containerBuilder->compile();
7777

78-
$commandLoader = new ContainerCommandLoader($container, array(
78+
$commandLoader = new ContainerCommandLoader($containerBuilder, array(
7979
'app:foo' => FooCommand::class,
8080
));
8181

8282
Like this, executing the ``app:foo`` command will load the ``FooCommand`` service
83-
by calling ``$container->get(FooCommand::class)``.
83+
by calling ``$containerBuilder->get(FooCommand::class)``.

doctrine.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ a controller, this is pretty easy. Add the following method to the
504504
public function createAction()
505505
{
506506
// you can fetch the EntityManager via $this->getDoctrine()
507-
// or you can add an argument to your action: createAction(EntityManagerInterface $em)
507+
// or you can add an argument to your action: createAction(EntityManagerInterface $entityManager)
508508
$entityManager = $this->getDoctrine()->getManager();
509509

510510
$product = new Product();
@@ -525,8 +525,8 @@ a controller, this is pretty easy. Add the following method to the
525525
public function editAction()
526526
{
527527
$doctrine = $this->getDoctrine();
528-
$em = $doctrine->getManager();
529-
$em2 = $doctrine->getManager('other_connection');
528+
$entityManager = $doctrine->getManager();
529+
$otherEntityManager = $doctrine->getManager('other_connection');
530530
}
531531

532532
.. note::

event_dispatcher/method_behavior.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ could listen to the ``mailer.post_send`` event and change the method's return va
121121
{
122122
public function onMailerPostSend(AfterSendMailEvent $event)
123123
{
124-
$ret = $event->getReturnValue();
125-
// modify the original ``$ret`` value
124+
$returnValue = $event->getReturnValue();
125+
// modify the original ``$returnValue`` value
126126

127-
$event->setReturnValue($ret);
127+
$event->setReturnValue($returnValue);
128128
}
129129

130130
public static function getSubscribedEvents()

form/create_custom_field_type.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,14 @@ add a ``__construct()`` method like normal::
297297

298298
class ShippingType extends AbstractType
299299
{
300-
private $em;
300+
private $entityManager;
301301

302-
public function __construct(EntityManagerInterface $em)
302+
public function __construct(EntityManagerInterface $entityManager)
303303
{
304-
$this->em = $em;
304+
$this->entityManager = $entityManager;
305305
}
306306

307-
// use $this->em down anywhere you want ...
307+
// use $this->entityManager down anywhere you want ...
308308
}
309309

310310
If you're using the default ``services.yml`` configuration (i.e. services from the

form/form_dependencies.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ create your form::
3636
// ...
3737
public function newAction()
3838
{
39-
$em = $this->getDoctrine()->getManager();
39+
$entityManager = $this->getDoctrine()->getManager();
4040

4141
$task = ...;
4242
$form = $this->createForm(TaskType::class, $task, array(
43-
'entity_manager' => $em,
43+
'entity_manager' => $entityManager,
4444
));
4545

4646
// ...

security/form_login_setup.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ Great! Next, add the logic to ``loginAction()`` that displays the login form::
143143
// src/AppBundle/Controller/SecurityController.php
144144
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
145145

146-
public function loginAction(Request $request, AuthenticationUtils $authUtils)
146+
public function loginAction(Request $request, AuthenticationUtils $authenticationUtils)
147147
{
148148
// get the login error if there is one
149-
$error = $authUtils->getLastAuthenticationError();
149+
$error = $authenticationUtils->getLastAuthenticationError();
150150

151151
// last username entered by the user
152-
$lastUsername = $authUtils->getLastUsername();
152+
$lastUsername = $authenticationUtils->getLastUsername();
153153

154154
return $this->render('security/login.html.twig', array(
155155
'last_username' => $lastUsername,
@@ -159,9 +159,9 @@ Great! Next, add the logic to ``loginAction()`` that displays the login form::
159159

160160
.. note::
161161

162-
If you get an error that the ``$authUtils`` argument is missing, it's
163-
probably because you need to activate this new feature in Symfony 3.4. See
164-
this :ref:`controller service argument note <controller-service-arguments-tag>`.
162+
If you get an error that the ``$authenticationUtils`` argument is missing,
163+
it's probably because you need to activate this new feature in Symfony 3.4.
164+
See this :ref:`controller service argument note <controller-service-arguments-tag>`.
165165

166166
Don't let this controller confuse you. As you'll see in a moment, when the
167167
user submits the form, the security system automatically handles the form

security/json_login_setup.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ path:
110110
use Symfony\Component\Routing\RouteCollection;
111111
use Symfony\Component\Routing\Route;
112112
113-
$collection = new RouteCollection();
114-
$collection->add('login', new Route('/login', array(
113+
$routes = new RouteCollection();
114+
$routes->add('login', new Route('/login', array(
115115
'_controller' => 'AppBundle:Security:login',
116116
)));
117117
118-
return $collection;
118+
return $routes;
119119
120120
Don't let this empty controller confuse you. When you submit a ``POST`` request
121121
to the ``/login`` URL with the following JSON document as the body, the security

workflow/usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ what actions are allowed on a blog post::
168168
// Update the currentState on the post
169169
try {
170170
$workflow->apply($post, 'to_review');
171-
} catch (LogicException $e) {
171+
} catch (LogicException $exception) {
172172
// ...
173173
}
174174

0 commit comments

Comments
 (0)