Skip to content

Commit a5e77cd

Browse files
committed
Merge remote-tracking branch 'upstream/master' into 4.2
2 parents f06a0ec + 4af99e7 commit a5e77cd

Some content is hidden

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

58 files changed

+342
-237
lines changed

bundles/configuration.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ The ``Configuration`` class to handle the sample configuration looks like::
198198
}
199199

200200
.. versionadded:: 4.2
201+
201202
Not passing the root node name to ``TreeBuilder`` was deprecated in Symfony 4.2.
202203

203204
.. seealso::

components/asset.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,6 @@ document inside a template::
375375
Local Files and Other Protocols
376376
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
377377

378-
.. versionadded:: 4.2
379-
The support for other protocols was introduced in Symfony 4.2.
380-
381378
In addition to HTTP this component supports other protocols (such as ``file://``
382379
and ``ftp://``). This allows for example to serve local files in order to
383380
improve performance::

components/browser_kit.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ simulate the link click::
105105

106106
$crawler = $client->clickLink('Go elsewhere...');
107107

108-
.. versionadded:: 4.2
109-
The ``clickLink()`` method was introduced in Symfony 4.2.
110-
111108
If you need the :class:`Symfony\\Component\\DomCrawler\\Link` object that
112109
provides access to the link properties (e.g. ``$link->getMethod()``,
113110
``$link->getUri()``), use this other method:
@@ -151,9 +148,6 @@ field values, etc.) before submitting it::
151148
['HTTP_ACCEPT_LANGUAGE' => 'es']
152149
);
153150

154-
.. versionadded:: 4.2
155-
The ``submitForm()`` method was introduced in Symfony 4.2.
156-
157151
If you need the :class:`Symfony\\Component\\DomCrawler\\Form` object that
158152
provides access to the form properties (e.g. ``$form->getUri()``,
159153
``$form->getValues()``, ``$form->getFields()``), use this other method::

components/cache/adapters/pdo_doctrine_dbal_adapter.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ third, and forth parameters::
3131
$options = []
3232
);
3333

34-
.. versionadded:: 4.2
35-
Automatic table creation was introduced in Symfony 4.2.
36-
3734
The table where values are stored is created automatically on the first call to
3835
the :method:`Symfony\\Component\\Cache\\Adapter\\PdoAdapter::save` method.
3936
You can also create this table explicitly by calling the

components/config/definition.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ implements the :class:`Symfony\\Component\\Config\\Definition\\ConfigurationInte
6969
}
7070

7171
.. versionadded:: 4.2
72+
7273
Not passing the root node name to ``TreeBuilder`` was deprecated in Symfony 4.2.
7374

7475
Adding Node Definitions to the Tree

components/console/helpers/progressbar.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,33 @@ that the progress bar display is refreshed with a 100% completion.
9595
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::display`
9696
to show the progress bar again.
9797

98+
If the progress information is stored in an iterable variable (such as an array
99+
or a PHP generator) you can use the
100+
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::iterate` method,
101+
which starts, advances and finishes the progress bar automatically::
102+
103+
use Symfony\Component\Console\Helper\ProgressBar;
104+
105+
$progressBar = new ProgressBar($output);
106+
107+
// $iterable can be for example an array ([1, 2, 3, ...]) or a generator
108+
// $iterable = function () { yield 1; yield 2; ... };
109+
foreach ($progressBar->iterate($iterable) as $value) {
110+
// ... do some work
111+
}
112+
113+
If ``$iterable = [1, 2]``, the previous code will output the following:
114+
115+
.. code-block:: terminal
116+
117+
0/2 [>---------------------------] 0%
118+
1/2 [==============>-------------] 50%
119+
2/2 [============================] 100%
120+
121+
.. versionadded:: 4.3
122+
123+
The ``iterate()`` method was introduced in Symfony 4.3.
124+
98125
Customizing the Progress Bar
99126
----------------------------
100127

components/console/helpers/table.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ You can optionally display titles at the top and the bottom of the table::
8888
| 80-902734-1-6 | And Then There Were None | Agatha Christie |
8989
+---------------+--------- Page 1/2 -------+------------------+
9090
91-
.. versionadded:: 4.2
92-
The ``setHeaderTitle()`` and ``setFooterTitle()`` methods were introduced
93-
in Symfony 4.2.
94-
9591
By default the width of the columns is calculated automatically based on their
9692
contents. Use the :method:`Symfony\\Component\\Console\\Helper\\Table::setColumnWidths`
9793
method to set the column widths explicitly::
@@ -154,9 +150,6 @@ The output of this command will be:
154150
| (the rest of rows...) |
155151
+-------+------------+--------------------------------+
156152
157-
.. versionadded:: 4.2
158-
The ``setColumnMaxWidth()`` method was introduced in Symfony 4.2.
159-
160153
The table style can be changed to any built-in styles via
161154
:method:`Symfony\\Component\\Console\\Helper\\Table::setStyle`::
162155

components/dom_crawler.rst

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,6 @@ Get all the direct child nodes matching a CSS selector::
186186

187187
$crawler->filter('body')->children('p.lorem');
188188

189-
.. versionadded:: 4.2
190-
The optional selector in ``children($selector)`` method was introduced in Symfony 4.2.
191-
192189
.. note::
193190

194191
All the traversal methods return a new :class:`Symfony\\Component\\DomCrawler\\Crawler`
@@ -204,8 +201,16 @@ Access the node name (HTML tag name) of the first node of the current selection
204201

205202
Access the value of the first node of the current selection::
206203

204+
// if the node does not exist, calling to text() will result in an exception
207205
$message = $crawler->filterXPath('//body/p')->text();
208206

207+
// avoid the exception passing an argument that text() returns when node does not exist
208+
$message = $crawler->filterXPath('//body/p')->text('Default text content');
209+
210+
.. versionadded:: 4.3
211+
212+
The default argument of ``text()`` was introduced in Symfony 4.3.
213+
209214
Access the attribute value of the first node of the current selection::
210215

211216
$class = $crawler->filterXPath('//body/p')->attr('class');
@@ -214,12 +219,17 @@ Extract attribute and/or node values from the list of nodes::
214219

215220
$attributes = $crawler
216221
->filterXpath('//body/p')
217-
->extract(['_text', 'class'])
222+
->extract(['_name', '_text', 'class'])
218223
;
219224

220225
.. note::
221226

222-
Special attribute ``_text`` represents a node value.
227+
Special attribute ``_text`` represents a node value, while ``_name``
228+
represents the element name (the HTML tag name).
229+
230+
.. versionadded:: 4.3
231+
232+
The special attribute ``_name`` was introduced in Symfony 4.3.
223233

224234
Call an anonymous function on each node of the list::
225235

@@ -296,8 +306,16 @@ and :phpclass:`DOMNode` objects::
296306
Or you can get the HTML of the first node using
297307
:method:`Symfony\\Component\\DomCrawler\\Crawler::html`::
298308

309+
// if the node does not exist, calling to html() will result in an exception
299310
$html = $crawler->html();
300311

312+
// avoid the exception passing an argument that html() returns when node does not exist
313+
$html = $crawler->html('Default <strong>HTML</strong> content');
314+
315+
.. versionadded:: 4.3
316+
317+
The default argument of ``html()`` was introduced in Symfony 4.3.
318+
301319
Expression Evaluation
302320
~~~~~~~~~~~~~~~~~~~~~
303321

components/dotenv.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ The ``load()`` method never overwrites existing environment variables. Use the
6464
// ...
6565
$dotenv->overload(__DIR__.'/.env');
6666

67-
.. versionadded:: 4.2
68-
The ``Dotenv::overload()`` method was introduced in Symfony 4.2.
69-
7067
You should never store a ``.env`` file in your code repository as it might
7168
contain sensitive information; create a ``.env.dist`` file with sensible
7269
defaults instead.

components/finder.rst

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,6 @@ Sort the result by name or by type (directories first, then files)::
175175
as its argument to use PHP's `natural sort order`_ algorithm instead (e.g.
176176
``file1.txt``, ``file2.txt``, ``file10.txt``).
177177

178-
.. versionadded:: 4.2
179-
180-
The option to use the natural sort order was introduced in Symfony 4.2.
181-
182178
Sort the files and directories by the last accessed, changed or modified time::
183179

184180
$finder->sortByAccessedTime();
@@ -198,10 +194,6 @@ You can reverse any sorting by using the ``reverseSorting()`` method::
198194
// results will be sorted "Z to A" instead of the default "A to Z"
199195
$finder->sortByName()->reverseSorting();
200196

201-
.. versionadded:: 4.2
202-
203-
The ``reverseSorting()`` method was introduced in Symfony 4.2.
204-
205197
.. note::
206198

207199
Notice that the ``sort*`` methods need to get all matching elements to do
@@ -238,11 +230,6 @@ Multiple filenames can be excluded by chaining calls or passing an array::
238230
// same as above
239231
$finder->files()->notName(['*.rb', '*.py']);
240232

241-
.. versionadded:: 4.2
242-
243-
Support for passing arrays to ``name()`` and ``notName()`` was introduced
244-
in Symfony 4.2
245-
246233
File Contents
247234
~~~~~~~~~~~~~
248235

@@ -285,10 +272,6 @@ Multiple paths can be defined by chaining calls or passing an array::
285272
// same as above
286273
$finder->path(['data', 'foo/bar']);
287274

288-
.. versionadded:: 4.2
289-
290-
Support for passing arrays to ``path()`` was introduced in Symfony 4.2
291-
292275
Internally, strings are converted into regular expressions by escaping slashes
293276
and adding delimiters:
294277

@@ -328,10 +311,6 @@ Restrict by a size range by chaining calls or passing an array::
328311
// same as above
329312
$finder->files()->size(['>= 1K', '<= 2K']);
330313

331-
.. versionadded:: 4.2
332-
333-
Support for passing arrays to ``size()`` was introduced in Symfony 4.2
334-
335314
The comparison operator can be any of the following: ``>``, ``>=``, ``<``, ``<=``,
336315
``==``, ``!=``.
337316

@@ -354,10 +333,6 @@ Restrict by a date range by chaining calls or passing an array::
354333
// same as above
355334
$finder->date(['>= 2018-01-01', '<= 2018-12-31']);
356335

357-
.. versionadded:: 4.2
358-
359-
Support for passing arrays to ``date()`` was introduced in Symfony 4.2
360-
361336
The comparison operator can be any of the following: ``>``, ``>=``, ``<``, ``<=``,
362337
``==``. You can also use ``since`` or ``after`` as an alias for ``>``, and
363338
``until`` or ``before`` as an alias for ``<``.
@@ -380,10 +355,6 @@ Restrict by a depth range by chaining calls or passing an array::
380355
// same as above
381356
$finder->depth(['> 2', '< 5']);
382357

383-
.. versionadded:: 4.2
384-
385-
Support for passing arrays to ``depth()`` was introduced in Symfony 4.2
386-
387358
Custom Filtering
388359
~~~~~~~~~~~~~~~~
389360

0 commit comments

Comments
 (0)