Skip to content

Commit f0e6fcb

Browse files
committed
Merge branch '3.4' into 4.3
* 3.4: Add in the DOW crawler documentation code sample to show how to tick checkboxes Adds the most basic informations about loaders [symfony#12075] fix some casing [Contributing] Add more information on deprecations
2 parents d40fd82 + 13a5281 commit f0e6fcb

File tree

3 files changed

+84
-19
lines changed

3 files changed

+84
-19
lines changed

components/config/resources.rst

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Loading Resources
1010
:phpfunction:`parse_ini_file` function. Therefore, you can only set
1111
parameters to string values. To set parameters to other data types
1212
(e.g. boolean, integer, etc), the other loaders are recommended.
13+
14+
Loaders populate the application's configuration from different sources like YAML files. The Config component defines the interface for such loaders. The :doc:`Dependency Injection </components/dependency_injection>` and :doc:`Routing </components/routing>` components come with specialized loaders for different file formats.
1315

1416
Locating Resources
1517
------------------

components/dom_crawler.rst

+8
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,9 @@ To work with multi-dimensional fields::
511511
<input name="multi[]"/>
512512
<input name="multi[]"/>
513513
<input name="multi[dimensional]"/>
514+
<input name="multi[dimensional][]" value="1"/>
515+
<input name="multi[dimensional][]" value="2"/>
516+
<input name="multi[dimensional][]" value="3"/>
514517
</form>
515518

516519
Pass an array of values::
@@ -524,6 +527,11 @@ Pass an array of values::
524527
'dimensional' => 'an other value',
525528
]]);
526529

530+
// tick multiple checkboxes at once
531+
$form->setValues(['multi' => [
532+
'dimensional' => [1, 3] // it uses the input value to determine which checkbox to tick
533+
]]);
534+
527535
This is great, but it gets better! The ``Form`` object allows you to interact
528536
with your form like a browser, selecting radio values, ticking checkboxes,
529537
and uploading files::

contributing/code/conventions.rst

+74-19
Original file line numberDiff line numberDiff line change
@@ -79,30 +79,46 @@ must be used instead (where ``XXX`` is the name of the related thing):
7979

8080
.. _contributing-code-conventions-deprecations:
8181

82-
Deprecations
83-
------------
82+
Deprecating Code
83+
----------------
8484

8585
From time to time, some classes and/or methods are deprecated in the
8686
framework; that happens when a feature implementation cannot be changed
8787
because of backward compatibility issues, but we still want to propose a
8888
"better" alternative. In that case, the old implementation can be **deprecated**.
8989

90+
Deprecations must only be introduced on the next minor version of the impacted
91+
component (or bundle, or bridge, or contract).
92+
They can exceptionally be introduced on previous supported versions if they are critical.
93+
94+
A new class (or interface, or trait) cannot be introduced as deprecated, or
95+
contain deprecated methods.
96+
97+
A new method cannot be introduced as deprecated.
98+
9099
A feature is marked as deprecated by adding a ``@deprecated`` phpdoc to
91100
relevant classes, methods, properties, ...::
92101

93102
/**
94-
* @deprecated since vendor-name/package-name 2.8, to be removed in 3.0. Use XXX instead.
103+
* @deprecated since Symfony 2.8.
104+
*/
105+
106+
The deprecation message must indicate the version in which the feature was deprecated,
107+
and whenever possible, how it was replaced::
108+
109+
/**
110+
* @deprecated since Symfony 2.8, use Replacement instead.
95111
*/
96112

97-
The deprecation message should indicate the version when the class/method was
98-
deprecated, the version when it will be removed, and whenever possible, how
99-
the feature was replaced.
113+
When the replacement is in another namespace than the deprecated class, its FQCN must be used::
114+
115+
/**
116+
* @deprecated since Symfony 2.8, use A\B\Replacement instead.
117+
*/
100118

101-
A PHP ``E_USER_DEPRECATED`` error must also be triggered to help people with
102-
the migration starting one or two minor versions before the version where the
103-
feature will be removed (depending on the criticality of the removal)::
119+
A PHP ``E_USER_DEPRECATED`` error must also be triggered to help people with the migration::
104120

105-
@trigger_error('XXX() is deprecated since vendor-name/package-name 2.8 and will be removed in 3.0. Use XXX instead.', E_USER_DEPRECATED);
121+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 2.8, use "%s" instead.', Deprecated::class, Replacement::class), E_USER_DEPRECATED);
106122

107123
Without the `@-silencing operator`_, users would need to opt-out from deprecation
108124
notices. Silencing swaps this behavior and allows users to opt-in when they are
@@ -113,19 +129,58 @@ the Web Debug Toolbar or by the PHPUnit bridge).
113129

114130
When deprecating a whole class the ``trigger_error()`` call should be placed
115131
between the namespace and the use declarations, like in this example from
116-
`ArrayParserCache`_::
132+
`ServiceRouterLoader`_::
117133

118-
namespace Symfony\Component\ExpressionLanguage\ParserCache;
134+
namespace Symfony\Component\Routing\Loader\DependencyInjection;
119135

120-
@trigger_error('The '.__NAMESPACE__.'\ArrayParserCache class is deprecated since version 3.2 and will be removed in 4.0. Use the Symfony\Component\Cache\Adapter\ArrayAdapter class instead.', E_USER_DEPRECATED);
136+
use Symfony\Component\Routing\Loader\ContainerLoader;
121137

122-
use Symfony\Component\ExpressionLanguage\ParsedExpression;
138+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', ServiceRouterLoader::class, ContainerLoader::class), E_USER_DEPRECATED);
123139

124140
/**
125-
* @author Adrien Brault <[email protected]>
126-
*
127-
* @deprecated since Symfony 3.2, to be removed in 4.0. Use the Symfony\Component\Cache\Adapter\ArrayAdapter class instead.
141+
* @deprecated since Symfony 4.4, use Symfony\Component\Routing\Loader\ContainerLoader instead.
128142
*/
129-
class ArrayParserCache implements ParserCacheInterface
143+
class ServiceRouterLoader extends ObjectRouteLoader
144+
145+
.. _`ServiceRouterLoader`: https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/Routing/Loader/DependencyInjection/ServiceRouterLoader.php
146+
147+
The deprecation must be added to the ``CHANGELOG.md`` file of the impacted component::
148+
149+
4.4.0
150+
-----
151+
152+
* Deprecated the `Deprecated` class, use `Replacement` instead.
153+
154+
It must also be added to the ``UPGRADE.md`` file of the targeted minor version
155+
(``UPGRADE-4.4.md`` in our example)::
156+
157+
DependencyInjection
158+
-------------------
159+
160+
* Deprecated the `Deprecated` class, use `Replacement` instead.
161+
162+
Finally, its consequences must be added to the ``UPGRADE.md`` file of the next major version
163+
(``UPGRADE-5.0.md`` in our example)::
164+
165+
DependencyInjection
166+
-------------------
167+
168+
* Removed the `Deprecated` class, use `Replacement` instead.
169+
170+
All these tasks are mandatory and must be done in the same pull request.
171+
172+
Removing Deprecated Code
173+
------------------------
174+
175+
Removing deprecated code can only be done once every 2 years, on the next major version of the
176+
impacted component (``master`` branch).
177+
178+
When removing deprecated code, the consequences of the deprecation must be added to the ``CHANGELOG.md`` file
179+
of the impacted component::
180+
181+
5.0.0
182+
-----
183+
184+
* Removed the `Deprecated` class, use `Replacement` instead.
130185

131-
.. _`ArrayParserCache`: https://github.com/symfony/symfony/blob/3.2/src/Symfony/Component/ExpressionLanguage/ParserCache/ArrayParserCache.php
186+
This task is mandatory and must be done in the same pull request.

0 commit comments

Comments
 (0)