8000 Merge branch '3.4' into 4.0 · symfony/symfony-docs@b6a6897 · GitHub
[go: up one dir, main page]

Skip to content

Commit b6a6897

Browse files
committed
Merge branch '3.4' into 4.0
* 3.4: Updated the service naming conventions for modern Symfony apps Documented the missing YAML flags Minor reword in the performance article Fixed Class Name Typo Mentioned the short syntax for XML config of service factories Always use PHPUnit Bridge to run tests Recommend to never inline PHPDoc blocks Added links to the roadmap of each Symfony version Documented the PhpExecutableFinder utility Fix references to annotation loader tip Improve the cache config reference Documented the feature to pass options in the memcached DSN Make code comments consistent Some fixes and rewords add Prefixing the Names of Imported Routes
2 parents 0be344b + d8fcd1c commit b6a6897

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+383
-248
lines changed

components/asset.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ suffix to any asset path::
121121
In case you want to modify the version format, pass a sprintf-compatible format
122122
string as the second argument of the ``StaticVersionStrategy`` constructor::
123123

124-
// put the 'version' word before the version value
124+
// puts the 'version' word before the version value
125125
$package = new Package(new StaticVersionStrategy('v1', '%s?version=%s'));
126126

127127
echo $package->getUrl('/image.png');
128128
// result: /image.png?version=v1
129129

130-
// put the asset version before its path
130+
// puts the asset version before its path
131131
$package = new Package(new StaticVersionStrategy('v1', '%2$s/%1$s'));
132132

133133
echo $package->getUrl('/image.png');

components/cache/adapters/memcached_adapter.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ helper method allows creating and configuring a `Memcached`_ class instance usin
5151
// pass a single DSN string to register a single server with the client
5252
$client = MemcachedAdapter::createConnection(
5353
'memcached://localhost'
54+
// the DSN can include config options (pass them as a query string):
55+
// 'memcached://localhost:11222?retry_timeout=10'
56+
// 'memcached://localhost:11222?socket_recv_size=1&socket_send_size=2'
5457
);
5558

5659
// pass an array of DSN strings to register multiple servers with the client
@@ -61,6 +64,10 @@ helper method allows creating and configuring a `Memcached`_ class instance usin
6164
// etc...
6265
));
6366

67+
.. versionadded:: 3.4
68+
The feature to pass configuration options in the memcached DSN was
69+
introduced in Symfony 3.4.
70+
6471
The `Data Source Name (DSN)`_ for this adapter must use the following format:
6572

6673
.. code-block:: text

components/console/events.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@ dispatched. Listeners receive a
3737
use Symfony\Component\Console\ConsoleEvents;
3838

3939
$dispatcher->addListener(ConsoleEvents::COMMAND, function (ConsoleCommandEvent $event) {
40-
// get the input instance
40+
// gets the input instance
4141
$input = $event->getInput();
4242

43-
// get the output instance
43+
// gets the output instance
4444
$output = $event->getOutput();
4545

46-
// get the command to be executed
46+
// gets the command to be executed
4747
$command = $event->getCommand();
4848

49-
// write something about the command
49+
// writes something about the command
5050
$output->writeln(sprintf('Before running command <info>%s</info>', $command->getName()));
5151

52-
// get the application
52+
// gets the application
5353
$application = $command->getApplication();
5454
});
5555

@@ -68,12 +68,12 @@ C/C++ standard.::
6868
use Symfony\Component\Console\ConsoleEvents;
6969

7070
$dispatcher->addListener(ConsoleEvents::COMMAND, function (ConsoleCommandEvent $event) {
71-
// get the command to be executed
71+
// gets the command to be executed
7272
$command = $event->getCommand();
7373

7474
// ... check if the command can be executed
7575

76-
// disable the command, this will result in the command being skipped
76+
// disables the command, this will result in the command being skipped
7777
// and code 113 being returned from the Application
7878
$event->disableCommand();
7979

@@ -107,10 +107,10 @@ Listeners receive a
107107

108108
$output->writeln(sprintf('Oops, exception thrown while running command <info>%s</info>', $command->getName()));
109109

110-
// get the current exit code (the exception code or the exit code set by a ConsoleEvents::TERMINATE event)
110+
// gets the current exit code (the exception code or the exit code set by a ConsoleEvents::TERMINATE event)
111111
$exitCode = $event->getExitCode();
112112

113-
// change the exception to another one
113+
// changes the exception to another one
114114
$event->setException(new \LogicException('Caught exception', $exitCode, $event->getError()));
115115
});
116116

@@ -133,16 +133,16 @@ Listeners receive a
133133
use Symfony\Component\Console\ConsoleEvents;
134134

135135
$dispatcher->addListener(ConsoleEvents::TERMINATE, function (ConsoleTerminateEvent $event) {
136-
// get the output
136+
// gets the output
137137
$output = $event->getOutput();
138138

139-
// get the command that has been executed
139+
// gets the command that has been executed
140140
$command = $event->getCommand();
141141

142-
// display something
142+
// displays the given content
143143
$output->writeln(sprintf('After running command <info>%s</info>', $command->getName()));
144144

145-
// change the exit code
145+
// changes the exit code
146146
$event->setExitCode(128);
147147
});
148148

components/console/helpers/progressbar.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ number of units, and advance the progress as the command executes::
1515

1616
use Symfony\Component\Console\Helper\ProgressBar;
1717

18-
// create a new progress bar (50 units)
18+
// creates a new progress bar (50 units)
1919
$progress = new ProgressBar($output, 50);
2020

21-
// start and displays the progress bar
21+
// starts and displays the progress bar
2222
$progress->start();
2323

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

28-
// advance the progress bar 1 unit
28+
// advances the progress bar 1 unit
2929
$progress->advance();
3030

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

35-
// ensure that the progress bar is at 100%
35+
// ensures that the progress bar is at 100%
3636
$progress->finish();
3737

3838
.. tip::

components/console/helpers/table.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ If the built-in styles do not fit your need, define your own::
150150
// by default, this is based on the default style
151151
$style = new TableStyle();
152152

153-
// customize the style
153+
// customizes the style
154154
$style
155155
->setHorizontalBorderChar('<fg=magenta>|</>')
156156
->setVerticalBorderChar('<fg=magenta>-</>')
157157
->setCrossingChar(' ')
158158
;
159159

160-
// use the style for this table
160+
// uses the custom style for this table
161161
$table->setStyle($style);
162162

163163
Here is a full list of things you can customize:
@@ -175,10 +175,10 @@ Here is a full list of things you can customize:
175175

176176
You can also register a style globally::
177177

178-
// register the style under the colorful name
178+
// registers the style under the colorful name
179179
Table::setStyleDefinition('colorful', $style);
180180

181-
// use it for a table
181+
// applies the custom style for the given table
182182
$table->setStyle('colorful');
183183

184184
This method can also be used to override a built-in style.

components/dom_crawler.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ An anonymous function can be used to filter with more complex criteria::
8989
$crawler = $crawler
9090
->filter('body > p')
9191
->reduce(function (Crawler $node, $i) {
92-
// filter every other node
92+
// filters every other node
9393
return ($i % 2) == 0;
9494
});
9595

@@ -185,7 +185,7 @@ Accessing Node Values
185185

186186
Access the node name (HTML tag name) of the first node of the current selection (eg. "p" or "div")::
187187

188-
// will return the node name (HTML tag name) of the first child element under <body>
188+
// returns the node name (HTML tag name) of the first child element under <body>
189189
$tag = $crawler->filterXPath('//body/*')->nodeName();
190190

191191
Access the value of the first node of the current selection::
@@ -358,7 +358,7 @@ instance with just the selected link(s). Calling ``link()`` gives you a special
358358
The :class:`Symfony\\Component\\DomCrawler\\Link` object has several useful
359359
methods to get more information about the selected link itself::
360360

361-
// return the proper URI that can be used to make another request
361+
// returns the proper URI that can be used to make another request
362362
$uri = $link->getUri();
363363

364364
.. note::
@@ -433,13 +433,13 @@ attribute followed by a query string of all of the form's values.
433433

434434
You can virtually set and get values on the form::
435435

436-
// set values on the form internally
436+
// sets values on the form internally
437437
$form->setValues(array(
438438
'registration[username]' => 'symfonyfan',
439439
'registration[terms]' => 1,
440440
));
441441

442-
// get back an array of values - in the "flat" array like above
442+
// gets back an array of values - in the "flat" array like above
443443
$values = $form->getValues();
444444

445445
// returns the values like PHP would see them,
@@ -456,10 +456,10 @@ To work with multi-dimensional fields::
456456

457457
Pass an array of values::
458458

459-
// Set a single field
459+
// sets a single field
460460
$form->setValues(array('multi' => array('value')));
461461

462-
// Set multiple fields at once
462+
// sets multiple fields at once
463463
$form->setValues(array('multi' => array(
464464
1 => 'value',
465465
'dimensional' => 'an other value'
@@ -471,17 +471,17 @@ and uploading files::
471471

472472
$form['registration[username]']->setValue('symfonyfan');
473473

474-
// check or uncheck a checkbox
474+
// checks or unchecks a checkbox
475475
$form['registration[terms]']->tick();
476476
$form['registration[terms]']->untick();
477477

478-
// select an option
478+
// selects an option
479479
$form['registration[birthday][year]']->select(1984);
480480

481-
// select many options from a "multiple" select
481+
// selects many options from a "multiple" select
482482
$form['registration[interests]']->select(array('symfony', 'cookies'));
483483

484-
// even fake a file upload
484+
// fakes a file upload
485485
$form['registration[photo]']->upload('/path/to/lucas.jpg');
486486

487487
Using the Form Data
@@ -510,7 +510,7 @@ directly::
510510

511511
use Goutte\Client;
512512

513-
// make a real request to an external site
513+
// makes a real request to an external site
514514
$client = new Client();
515515
$crawler = $client->request('GET', 'https://github.com/login');
516516

@@ -519,7 +519,7 @@ directly::
519519
$form['login'] = 'symfonyfan';
520520
$form['password'] = 'anypass';
521521

522-
// submit that form
522+
// submits the given form
523523
$crawler = $client->submit($form);
524524

525525
.. _components-dom-crawler-invalid:
@@ -532,10 +532,10 @@ to prevent you from setting invalid values. If you want to be able to set
532532
invalid values, you can use the ``disableValidation()`` method on either
533533
the whole form or specific field(s)::
534534

535-
// Disable validation for a specific field
535+
// disables validation for a specific field
536536
$form['country']->disableValidation()->select('Invalid value');
537537

538-
// Disable validation for the whole form
538+
// disables validation for the whole form
539539
$form->disableValidation();
540540
$form['country']->select('Invalid value');
541541

components/event_dispatcher.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ determine which instance is passed.
207207

208208
$containerBuilder->register('event_dispatcher', EventDispatcher::class);
209209

210-
// register an event listener
210+
// registers an event listener
211211
$containerBuilder->register('listener_service_id', \AcmeListener::class)
212212
->addTag('kernel.event_listener', array(
213213
'event' => 'acme.foo.action',
214214
'method' => 'onFooAction',
215215
));
216216

217-
// register an event subscriber
217+
// registers an event subscriber
218218
$containerBuilder->register('subscriber_service_id', \AcmeSubscriber::class)
219219
->addTag('kernel.event_subscriber');
220220

@@ -299,7 +299,7 @@ each listener of that event::
299299
$order = new Order();
300300
// ...
301301

302-
// create the OrderPlacedEvent and dispatch it
302+
// creates the OrderPlacedEvent and dispatches it
303303
$event = new OrderPlacedEvent($order);
304304
$dispatcher->dispatch(OrderPlacedEvent::NAME, $event);
305305

components/event_dispatcher/traceable_dispatcher.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ to register event listeners and dispatch events::
2727

2828
// ...
2929

30-
// register an event listener
30+
// registers an event listener
3131
$eventListener = ...;
3232
$priority = ...;
3333
$traceableEventDispatcher->addListener(
@@ -36,7 +36,7 @@ to register event listeners and dispatch events::
3636
$priority
3737
);
3838

39-
// dispatch an event
39+
// dispatches an event
4040
$event = ...;
4141
$traceableEventDispatcher->dispatch('event.the_name', $event);
4242

components/expression_language/extending.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ or by using the second argument of the constructor::
129129
{
130130
public function __construct(ParserCacheInterface $parser = null, array $providers = array())
131131
{
132-
// prepend the default provider to let users override it easily
132+
// prepends the default provider to let users override it easily
133133
array_unshift($providers, new StringExpressionLanguageProvider());
134134

135135
parent::__construct($parser, $providers);

0 commit comments

Comments
 (0)
0