Skip to content

Commit a3b0897

Browse files
committed
Merge branch 'fabpot-deprecations' into 2.0
2 parents b774bc2 + d1b4f80 commit a3b0897

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

contributing/code/conventions.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,29 @@ must be used instead (where ``XXX`` is the name of the related thing):
7676
difference: "setXXX" may replace, or add new elements to the relation.
7777
"replaceXXX", on the other hand, cannot add new elements. If an unrecognized
7878
key as passed to "replaceXXX" it must throw an exception.
79+
80+
Deprecations
81+
------------
82+
83+
From time to time, some classes and/or methods are deprecated in the
84+
framework; that happens when a feature implementation cannot be changed
85+
because of backward compatibility issues, but we still want to propose a
86+
"better" alternative. In that case, the old implementation can simply be
87+
**deprecated**.
88+
89+
A feature is marked as deprecated by adding a ``@deprecated`` phpdoc to
90+
relevant classes, methods, properties, ...::
91+
92+
/**
93+
* @deprecated Deprecated since version 2.X, to be removed in 2.Y. Use XXX instead.
94+
*/
95+
96+
The deprecation message should indicate the version when the class/method was
97+
deprecated, the version when it will be removed, and whenever possible, how
98+
the feature was replaced.
99+
100+
A PHP ``E_USER_DEPRECATED`` error must also be triggered to help people with
101+
the migration starting one or two minor versions before the version where the
102+
feature will be removed (depending of the criticality of the removal)::
103+
104+
trigger_error('XXX() is deprecated since version 2.X and will be removed in 2.Y. Use XXX instead.', E_USER_DEPRECATED);

contributing/code/patches.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,9 @@ Work on your Patch
153153
Work on the code as much as you want and commit as much as you want; but keep
154154
in mind the following:
155155

156-
* Follow the coding :doc:`standards <standards>` (use `git diff --check` to
157-
check for trailing spaces -- also read the tip below);
156+
* Read about the Symfony :doc:`conventions <conventions>` and follow the
157+
coding :doc:`standards <standards>` (use `git diff --check` to check for
158+
trailing spaces -- also read the tip below);
158159

159160
* Add unit tests to prove that the bug is fixed or that the new feature
160161
actually works;

contributing/community/releases.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ be scheduled for the next major version: Symfony 3.0.
8484
The work on Symfony 3.0 will start whenever enough major features breaking
8585
backward compatibility are waiting on the todo-list.
8686

87+
Deprecations
88+
------------
89+
90+
When a feature implementation cannot be replaced with a better one without
91+
breaking backward compatibility, there is still the possibility to deprecate
92+
the old implementation and add a new preferred one along side. Read the
93+
:doc:`conventions <../code/conventions>` document to learn more about how
94+
deprecations are handled in Symfony.
95+
8796
Rationale
8897
---------
8998

0 commit comments

Comments
 (0)