Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 02da88e

Browse filesBrowse files
committed
Merge branch '2.7' into 2.8
* 2.7: Clarify unanimous access strategy description Improve variable naming
2 parents 189e632 + a34ed7d commit 02da88e
Copy full SHA for 02da88e

File tree

Expand file treeCollapse file tree

97 files changed

+593
-597
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

97 files changed

+593
-597
lines changed

‎best_practices/configuration.rst

Copy file name to clipboardExpand all lines: best_practices/configuration.rst
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,20 @@ to control the number of posts to display on the blog homepage:
101101
102102
# app/config/config.yml
103103
parameters:
104-
homepage.num_items: 10
104+
homepage.number_of_items: 10
105105
106106
If you've done something like this in the past, it's likely that you've in fact
107107
*never* actually needed to change that value. Creating a configuration
108108
option for a value that you are never going to configure just isn't necessary.
109109
Our recommendation is to define these values as constants in your application.
110-
You could, for example, define a ``NUM_ITEMS`` constant in the ``Post`` entity::
110+
You could, for example, define a ``NUMBER_OF_ITEMS`` constant in the ``Post`` entity::
111111

112112
// src/AppBundle/Entity/Post.php
113113
namespace AppBundle\Entity;
114114

115115
class Post
116116
{
117-
const NUM_ITEMS = 10;
117+
const NUMBER_OF_ITEMS = 10;
118118

119119
// ...
120120
}
@@ -129,7 +129,7 @@ Constants can be used for example in your Twig templates thanks to the
129129
.. code-block:: html+twig
130130

131131
<p>
132-
Displaying the {{ constant('NUM_ITEMS', post) }} most recent results.
132+
Displaying the {{ constant('NUMBER_OF_ITEMS', post) }} most recent results.
133133
</p>
134134

135135
And Doctrine entities and repositories can now easily access these values,
@@ -144,7 +144,7 @@ whereas they cannot access the container parameters:
144144
145145
class PostRepository extends EntityRepository
146146
{
147-
public function findLatest($limit = Post::NUM_ITEMS)
147+
public function findLatest($limit = Post::NUMBER_OF_ITEMS)
148148
{
149149
// ...
150150
}

‎best_practices/forms.rst

Copy file name to clipboardExpand all lines: best_practices/forms.rst
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ Handling a form submit usually follows a similar template:
183183
$form->handleRequest($request);
184184
185185
if ($form->isSubmitted() && $form->isValid()) {
186-
$em = $this->getDoctrine()->getManager();
187-
$em->persist($post);
188-
$em->flush();
186+
$entityManager = $this->getDoctrine()->getManager();
187+
$entityManager->persist($post);
188+
$entityManager->flush();
189189
190190
return $this->redirect($this->generateUrl(
191191
'admin_post_show',

‎bundles/configuration.rst

Copy file name to clipboardExpand all lines: bundles/configuration.rst
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ In your extension, you can load this and dynamically set its arguments::
269269
$configuration = new Configuration();
270270
$config = $this->processConfiguration($configuration, $configs);
271271

272-
$def = $container->getDefinition('acme.social.twitter_client');
273-
$def->replaceArgument(0, $config['twitter']['client_id']);
274-
$def->replaceArgument(1, $config['twitter']['client_secret']);
272+
$definition = $container->getDefinition('acme.social.twitter_client');
273+
$definition->replaceArgument(0, $config['twitter']['client_id']);
274+
$definition->replaceArgument(1, $config['twitter']['client_secret']);
275275
}
276276

277277
.. tip::

‎components/asset.rst

Copy file name to clipboardExpand all lines: components/asset.rst
+13-13Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ that path over and over again::
169169
use Symfony\Component\Asset\PathPackage;
170170
// ...
171171

172-
$package = new PathPackage('/static/images', new StaticVersionStrategy('v1'));
172+
$pathPackage = new PathPackage('/static/images', new StaticVersionStrategy('v1'));
173173

174-
echo $package->getUrl('/logo.png');
174+
echo $pathPackage->getUrl('/logo.png');
175175
// result: /static/images/logo.png?v1
176176

177177
Request Context Aware Assets
@@ -185,13 +185,13 @@ class can take into account the context of the current request::
185185
use Symfony\Component\Asset\Context\RequestStackContext;
186186
// ...
187187

188-
$package = new PathPackage(
188+
$pathPackage = new PathPackage(
189189
'/static/images',
190190
new StaticVersionStrategy('v1'),
191191
new RequestStackContext($requestStack)
192192
);
193193

194-
echo $package->getUrl('/logo.png');
194+
echo $pathPackage->getUrl('/logo.png');
195195
// result: /somewhere/static/images/logo.png?v1
196196

197197
Now that the request context is set, the ``PathPackage`` will prepend the
@@ -212,25 +212,25 @@ class to generate absolute URLs for their assets::
212212
use Symfony\Component\Asset\UrlPackage;
213213
// ...
214214

215-
$package = new UrlPackage(
215+
$urlPackage = new UrlPackage(
216216
'http://static.example.com/images/',
217217
new StaticVersionStrategy('v1')
218218
);
219219

220-
echo $package->getUrl('/logo.png');
220+
echo $urlPackage->getUrl('/logo.png');
221221
// result: http://static.example.com/images/logo.png?v1
222222

223223
You can also pass a schema-agnostic URL::
224224

225225
use Symfony\Component\Asset\UrlPackage;
226226
// ...
227227

228-
$package = new UrlPackage(
228+
$urlPackage = new UrlPackage(
229229
'//static.example.com/images/',
230230
new StaticVersionStrategy('v1')
231231
);
232232

233-
echo $package->getUrl('/logo.png');
233+
echo $urlPackage->getUrl('/logo.png');
234234
// result: //static.example.com/images/logo.png?v1
235235

236236
This is useful because assets will automatically be requested via HTTPS if
@@ -248,11 +248,11 @@ constructor::
248248
'//static1.example.com/images/',
249249
'//static2.example.com/images/',
250250
);
251-
$package = new UrlPackage($urls, new StaticVersionStrategy('v1'));
251+
$urlPackage = new UrlPackage($urls, new StaticVersionStrategy('v1'));
252252

253-
echo $package->getUrl('/logo.png');
253+
echo $urlPackage->getUrl('/logo.png');
254254
// result: http://static1.example.com/images/logo.png?v1
255-
echo $package->getUrl('/icon.png');
255+
echo $urlPackage->getUrl('/icon.png');
256256
// result: http://static2.example.com/images/icon.png?v1
257257

258258
For each asset, one of the URLs will be randomly used. But, the selection
@@ -271,13 +271,13 @@ protocol-relative URLs for HTTPs requests, any base URL for HTTP requests)::
271271
use Symfony\Component\Asset\Context\RequestStackContext;
272272
// ...
273273

274-
$package = new UrlPackage(
274+
$urlPackage = new UrlPackage(
275275
array('http://example.com/', 'https://example.com/'),
276276
new StaticVersionStrategy('v1'),
277277
new RequestStackContext($requestStack)
278278
);
279279

280-
echo $package->getUrl('/logo.png');
280+
echo $urlPackage->getUrl('/logo.png');
281281
// assuming the RequestStackContext says that we are on a secure host
282282
// result: https://example.com/logo.png?v1
283283

‎components/browser_kit.rst

Copy file name to clipboardExpand all lines: components/browser_kit.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ retrieve any cookie while making requests with the client::
140140
// Get cookie data
141141
$name = $cookie->getName();
142142
$value = $cookie->getValue();
143-
$raw = $cookie->getRawValue();
144-
$secure = $cookie->isSecure();
143+
$rawValue = $cookie->getRawValue();
144+
$isSecure = $cookie->isSecure();
145145
$isHttpOnly = $cookie->isHttpOnly();
146146
$isExpired = $cookie->isExpired();
147147
$expires = $cookie->getExpiresTime();

‎components/config/definition.rst

Copy file name to clipboardExpand all lines: components/config/definition.rst
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,8 @@ tree with ``append()``::
537537

538538
public function addParametersNode()
539539
{
540-
$builder = new TreeBuilder();
541-
$node = $builder->root('parameters');
540+
$treeBuilder = new TreeBuilder();
541+
$node = $treeBuilder->root('parameters');
542542

543543
$node
544544
->isRequired()
@@ -775,18 +775,18 @@ Otherwise the result is a clean array of configuration values::
775775
use Symfony\Component\Config\Definition\Processor;
776776
use Acme\DatabaseConfiguration;
777777

778-
$config1 = Yaml::parse(
778+
$config = Yaml::parse(
779779
file_get_contents(__DIR__.'/src/Matthias/config/config.yml')
780780
);
781-
$config2 = Yaml::parse(
781+
$extraConfig = Yaml::parse(
782782
file_get_contents(__DIR__.'/src/Matthias/config/config_extra.yml')
783783
);
784784

785-
$configs = array($config1, $config2);
785+
$configs = array($config, $extraConfig);
786786

787787
$processor = new Processor();
788-
$configuration = new DatabaseConfiguration();
788+
$databaseConfiguration = new DatabaseConfiguration();
789789
$processedConfiguration = $processor->processConfiguration(
790-
$configuration,
790+
$databaseConfiguration,
791791
$configs
792792
);

‎components/config/resources.rst

Copy file name to clipboardExpand all lines: components/config/resources.rst
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ files. This can be done with the :class:`Symfony\\Component\\Config\\FileLocator
2121

2222
$configDirectories = array(__DIR__.'/app/config');
2323

24-
$locator = new FileLocator($configDirectories);
25-
$yamlUserFiles = $locator->locate('users.yml', null, false);
24+
$fileLocator = new FileLocator($configDirectories);
25+
$yamlUserFiles = $fileLocator->locate('users.yml', null, false);
2626

2727
The locator receives a collection of locations where it should look for
2828
files. The first argument of ``locate()`` is the name of the file to look
@@ -84,7 +84,7 @@ the resource::
8484
use Symfony\Component\Config\Loader\LoaderResolver;
8585
use Symfony\Component\Config\Loader\DelegatingLoader;
8686

87-
$loaderResolver = new LoaderResolver(array(new YamlUserLoader($locator)));
87+
$loaderResolver = new LoaderResolver(array(new YamlUserLoader($fileLocator)));
8888
$delegatingLoader = new DelegatingLoader($loaderResolver);
8989

9090
$delegatingLoader->load(__DIR__.'/users.yml');

‎components/console/helpers/dialoghelper.rst

Copy file name to clipboardExpand all lines: components/console/helpers/dialoghelper.rst
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ You can also ask question with more than a simple yes/no answer. For instance,
5252
if you want to know a bundle name, you can add this to your command::
5353

5454
// ...
55-
$bundle = $dialog->ask(
55+
$bundleName = $dialog->ask(
5656
$output,
5757
'Please enter the name of the bundle',
5858
'AcmeDemoBundle'
@@ -71,7 +71,7 @@ will be autocompleted as the user types::
7171

7272
$dialog = $this->getHelper('dialog');
7373
$bundleNames = array('AcmeDemoBundle', 'AcmeBlogBundle', 'AcmeStoreBundle');
74-
$name = $dialog->ask(
74+
$bundleName = $dialog->ask(
7575
$output,
7676
'Please enter the name of a bundle',
7777
'FooBundle',
@@ -109,7 +109,7 @@ be suffixed with ``Bundle``. You can validate that by using the
109109
method::
110110

111111
// ...
112-
$bundle = $dialog->askAndValidate(
112+
$bundleName = $dialog->askAndValidate(
113113
$output,
114114
'Please enter the name of the bundle',
115115
function ($answer) {

‎components/console/helpers/progressbar.rst

Copy file name to clipboardExpand all lines: components/console/helpers/progressbar.rst
+23-23Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,24 @@ number of units, and advance the progress as the command executes::
1616
use Symfony\Component\Console\Helper\ProgressBar;
1717

1818
// creates a new progress bar (50 units)
19-
$progress = new ProgressBar($output, 50);
19+
$progressBar = new ProgressBar($output, 50);
2020

2121
// starts and displays the progress bar
22-
$progress->start();
22+
$progressBar->start();
2323

2424
$i = 0;
2525
while ($i++ < 50) {
2626
// ... do some work
2727

2828
// advances the progress bar 1 unit
29-
$progress->advance();
29+
$progressBar->advance();
3030

3131
// you can also advance the progress bar by more than 1 unit
32-
// $progress->advance(3);
32+
// $progressBar->advance(3);
3333
}
3434

3535
// ensures that the progress bar is at 100%
36-
$progress->finish();
36+
$progressBar->finish();
3737

3838
Instead of advancing the bar by a number of steps (with the
3939
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::advance` method),
@@ -53,7 +53,7 @@ If you don't know the number of steps in advance, just omit the steps argument
5353
when creating the :class:`Symfony\\Component\\Console\\Helper\\ProgressBar`
5454
instance::
5555

56-
$progress = new ProgressBar($output);
56+
$progressBar = new ProgressBar($output);
5757

5858
The progress will then be displayed as a throbber:
5959

@@ -120,7 +120,7 @@ level of verbosity of the ``OutputInterface`` instance:
120120
Instead of relying on the verbosity mode of the current command, you can also
121121
force a format via ``setFormat()``::
122122

123-
$bar->setFormat('verbose');
123+
$progressBar->setFormat('verbose');
124124

125125
The built-in formats are the following:
126126

@@ -142,7 +142,7 @@ Custom Formats
142142

143143
Instead of using the built-in formats, you can also set your own::
144144

145-
$bar->setFormat('%bar%');
145+
$progressBar->setFormat('%bar%');
146146

147147
This sets the format to only display the progress bar itself:
148148

@@ -169,7 +169,7 @@ current progress of the bar. Here is a list of the built-in placeholders:
169169
For instance, here is how you could set the format to be the same as the
170170
``debug`` one::
171171

172-
$bar->setFormat(' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%');
172+
$progressBar->setFormat(' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%');
173173

174174
Notice the ``:6s`` part added to some placeholders? That's how you can tweak
175175
the appearance of the bar (formatting and alignment). The part after the colon
@@ -180,8 +180,8 @@ also define global formats::
180180

181181
ProgressBar::setFormatDefinition('minimal', 'Progress: %percent%%');
182182

183-
$bar = new ProgressBar($output, 3);
184-
$bar->setFormat('minimal');
183+
$progressBar = new ProgressBar($output, 3);
184+
$progressBar->setFormat('minimal');
185185

186186
This code defines a new ``minimal`` format that you can then use for your
187187
progress bars:
@@ -205,8 +205,8 @@ variant::
205205
ProgressBar::setFormatDefinition('minimal', '%percent%% %remaining%');
206206
ProgressBar::setFormatDefinition('minimal_nomax', '%percent%%');
207207

208-
$bar = new ProgressBar($output);
209-
$bar->setFormat('minimal');
208+
$progressBar = new ProgressBar($output);
209+
$progressBar->setFormat('minimal');
210210

211211
When displaying the progress bar, the format will automatically be set to
212212
``minimal_nomax`` if the bar does not have a maximum number of steps like in
@@ -235,16 +235,16 @@ Amongst the placeholders, ``bar`` is a bit special as all the characters used
235235
to display it can be customized::
236236

237237
// the finished part of the bar
238-
$progress->setBarCharacter('<comment>=</comment>');
238+
$progressBar->setBarCharacter('<comment>=</comment>');
239239

240240
// the unfinished part of the bar
241-
$progress->setEmptyBarCharacter(' ');
241+
$progressBar->setEmptyBarCharacter(' ');
242242

243243
// the progress character
244-
$progress->setProgressCharacter('|');
244+
$progressBar->setProgressCharacter('|');
245245

246246
// the bar width
247-
$progress->setBarWidth(50);
247+
$progressBar->setBarWidth(50);
248248

249249
.. caution::
250250

@@ -254,17 +254,17 @@ to display it can be customized::
254254
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::setRedrawFrequency`,
255255
so it updates on only some iterations::
256256

257-
$progress = new ProgressBar($output, 50000);
258-
$progress->start();
257+
$progressBar = new ProgressBar($output, 50000);
258+
$progressBar->start();
259259

260260
// update every 100 iterations
261-
$progress->setRedrawFrequency(100);
261+
$progressBar->setRedrawFrequency(100);
262262

263263
$i = 0;
264264
while ($i++ < 50000) {
265265
// ... do some work
266266

267-
$progress->advance();
267+
$progressBar->advance();
268268
}
269269

270270
Custom Placeholders
@@ -277,8 +277,8 @@ that displays the number of remaining steps::
277277

278278
ProgressBar::setPlaceholderFormatterDefinition(
279279
'remaining_steps',
280-
function (ProgressBar $bar, OutputInterface $output) {
281-
return $bar->getMaxSteps() - $bar->getProgress();
280+
function (ProgressBar $progressBar, OutputInterface $output) {
281+
return $progressBar->getMaxSteps() - $progressBar->getProgress();
282282
}
283283
);
284284

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.