@@ -50,7 +50,7 @@ sticks to these rules.
5050..caution ::
5151
5252 The exception to this rule are interfaces tagged with ``@internal ``. Such
53- interfaces should* never * be used or implemented.
53+ interfaces shouldnot be used or implemented.
5454
5555If you want to implement an interface, you should first make sure that the
5656interface is an API interface. You can recognize API interfaces by the ``@api ``
@@ -69,9 +69,15 @@ tag in their source code::
6969 }
7070
7171If you implement an API interface, we promise that we won't ever break your
72- code. Regular interfaces, by contrast, should never be implemented, because if
73- we add a new method to the interface or add a new optional parameter to the
74- signature of a method, we would generate a fatal error in your application.
72+ code. Regular interfaces, by contrast, may be extended between minor releases,
73+ for example by adding a new method. Be prepared to upgrade your code manually
74+ if you implement a regular interface.
75+
76+ ..note ::
77+
78+ Even if we do changes that require manual upgrades, we limit ourselves to
79+ changes that can be upgraded easily. We will always document the precise
80+ upgrade instructions in the UPGRADE file in Symfony's root directory.
7581
7682The following table explains in detail which use cases are covered by our
7783backwards compatibility promise:
@@ -89,9 +95,9 @@ backwards compatibility promise:
8995+-----------------------------------------------+---------------+---------------+
9096| Implement a method| No [1 ]_| Yes|
9197+-----------------------------------------------+---------------+---------------+
92- | Adda parameter to an implemented method| No [1 ]_| Yes|
98+ | Addan argument to an implemented method| No [1 ]_| Yes|
9399+-----------------------------------------------+---------------+---------------+
94- | Add a default value toa parameter | Yes| Yes|
100+ | Add a default value toan argument | Yes| Yes|
95101+-----------------------------------------------+---------------+---------------+
96102
97103..include ::_api_tagging.rst.inc
@@ -107,7 +113,7 @@ public methods and properties.
107113 Classes, properties and methods that bear the tag ``@internal `` as well as
108114 the classes located in the various ``*\\Tests\\ `` namespaces are an
109115 exception to this rule. They are meant for internal use only and should
110- * never * be accessed by your own code.
116+ not be accessed by your own code.
111117
112118Just like with interfaces, we also distinguish between regular and API classes.
113119Like API interfaces, API classes are marked with an ``@api `` tag::
@@ -127,9 +133,15 @@ Like API interfaces, API classes are marked with an ``@api`` tag::
127133The difference between regular and API classes is that we guarantee full
128134backwards compatibility if you extend an API class and override its methods. We
129135can't give the same promise for regular classes, because there we may, for
130- example, add an optionalparameter to a method. Consequently, the signature of
136+ example, add an optionalargument to a method. Consequently, the signature of
131137your overridden method wouldn't match anymore and generate a fatal error.
132138
139+ ..note ::
140+
141+ As with interfaces, we limit ourselves to changes that can be upgraded
142+ easily. We will document the precise ugprade instructions in the UPGRADE
143+ file in Symfony's root directory.
144+
133145In some cases, only specific properties and methods are tagged with the ``@api ``
134146tag, even though their class is not. In these cases, we guarantee full backwards
135147compatibility for the tagged properties and methods (as indicated in the column
@@ -171,9 +183,13 @@ covered by our backwards compatibility promise:
171183+-----------------------------------------------+---------------+---------------+
172184| Add a new method| No| No|
173185+-----------------------------------------------+---------------+---------------+
174- | Add a parameter to an overridden method| No [1 ]_| Yes|
186+ | Add an argument to an overridden method| No [1 ]_| Yes|
187+ +-----------------------------------------------+---------------+---------------+
188+ | Add a default value to an argument| Yes| Yes|
189+ +-----------------------------------------------+---------------+---------------+
190+ | Call a private method (via Reflection)| No| No|
175191+-----------------------------------------------+---------------+---------------+
176- | Add adefault value to a parameter | Yes | Yes |
192+ | Access aprivate property (via Reflection) | No | No |
177193+-----------------------------------------------+---------------+---------------+
178194
179195..include ::_api_tagging.rst.inc
@@ -201,14 +217,14 @@ Remove parent interface No No
201217Add method Yes [2 ]_ No
202218Remove method No No
203219Change name No No
204- Addparameter without a default value No No
205- Addparameter with a default value Yes [2 ]_ No
206- Removeparameter Yes [3 ]_ Yes [3 ]_
207- Add default value toa parameter Yes [2 ]_ No
208- Remove default value ofa parameter No No
209- Add type hint toa parameter No No
210- Remove type hint ofa parameter Yes [2 ]_ No
211- Changeparameter type Yes [2 ]_ [4 ]_ No
220+ Addargument without a default value No No
221+ Addargument with a default value Yes [2 ]_ No
222+ Removeargument Yes [3 ]_ Yes [3 ]_
223+ Add default value toan argument Yes [2 ]_ No
224+ Remove default value ofan argument No No
225+ Add type hint toan argument No No
226+ Remove type hint ofan argument Yes [2 ]_ No
227+ Changeargument type Yes [2 ]_ [4 ]_ No
212228Change return type Yes [2 ]_ [5 ]_ No
213229============================================== ============== ==============
214230
@@ -236,8 +252,11 @@ Reduce visibility No No
236252Add protected property Yes Yes
237253Remove protected property Yes [2 ]_ No
238254Reduce visibility Yes [2 ]_ No
255+ **Private Properties **
256+ Add private property Yes Yes
257+ Remove private property Yes Yes
239258**Constructors **
240- Add constructor without mandatoryparameters Yes [2 ]_ Yes [2 ]_
259+ Add constructor without mandatoryarguments Yes [2 ]_ Yes [2 ]_
241260Remove constructor Yes [2 ]_ No
242261Reduce visibility of a public constructor No No
243262Reduce visibility of a protected constructor Yes [2 ]_ No
@@ -246,29 +265,43 @@ Add public method Yes Yes
246265Remove public method No No
247266Change name No No
248267Reduce visibility No No
249- Addparameter without a default value No No
250- Addparameter with a default value Yes [2 ]_ No
251- Removeparameter Yes [3 ]_ Yes [3 ]_
252- Add default value toa parameter Yes [2 ]_ No
253- Remove default value ofa parameter No No
254- Add type hint toa parameter Yes [7 ]_ No
255- Remove type hint ofa parameter Yes [2 ]_ No
256- Changeparameter type Yes [2 ]_ [4 ]_ No
268+ Addargument without a default value No No
269+ Addargument with a default value Yes [2 ]_ No
270+ Removeargument Yes [3 ]_ Yes [3 ]_
271+ Add default value toan argument Yes [2 ]_ No
272+ Remove default value ofan argument No No
273+ Add type hint toan argument Yes [7 ]_ No
274+ Remove type hint ofan argument Yes [2 ]_ No
275+ Changeargument type Yes [2 ]_ [4 ]_ No
257276Change return type Yes [2 ]_ [5 ]_ No
258277**Protected Methods **
259278Add protected method Yes Yes
260279Remove protected method Yes [2 ]_ No
261280Change name No No
262281Reduce visibility Yes [2 ]_ No
263- Addparameter without a default value Yes [2 ]_ No
264- Addparameter with a default value Yes [2 ]_ No
265- Removeparameter Yes [3 ]_ Yes [3 ]_
266- Add default value toa parameter Yes [2 ]_ No
267- Remove default value ofa parameter Yes [2 ]_ No
268- Add type hint toa parameter Yes [2 ]_ No
269- Remove type hint ofa parameter Yes [2 ]_ No
270- Changeparameter type Yes [2 ]_ [4 ]_ No
282+ Addargument without a default value Yes [2 ]_ No
283+ Addargument with a default value Yes [2 ]_ No
284+ Removeargument Yes [3 ]_ Yes [3 ]_
285+ Add default value toan argument Yes [2 ]_ No
286+ Remove default value ofan argument Yes [2 ]_ No
287+ Add type hint toan argument Yes [2 ]_ No
288+ Remove type hint ofan argument Yes [2 ]_ No
289+ Changeargument type Yes [2 ]_ [4 ]_ No
271290Change return type Yes [2 ]_ [5 ]_ No
291+ **Private Methods **
292+ Add private method Yes Yes
293+ Remove private method Yes Yes
294+ Change name Yes Yes
295+ Reduce visibility Yes Yes
296+ Add argument without a default value Yes Yes
297+ Add argument with a default value Yes Yes
298+ Remove argument Yes Yes
299+ Add default value to an argument Yes Yes
300+ Remove default value of an argument Yes Yes
301+ Add type hint to an argument Yes Yes
302+ Remove type hint of an argument Yes Yes
303+ Change argument type Yes Yes
304+ Change return type Yes Yes
272305================================================== ============== ==============
273306
274307.. [1 ]Your code may be broken by changes in the Symfony code. Such changes will
@@ -277,9 +310,10 @@ Change return type Yes [2]_ [5]_ No
277310 .. [2 ]Should be avoided. When done, this change must be documented in the
278311 UPGRADE file.
279312
280- .. [3 ]Only the last parameter(s) of a method may be removed.
313+ .. [3 ]Only the last argument(s) of a method may be removed, as PHP does not
314+ care about additional arguments that you pass to a method.
281315
282- .. [4 ]Theparameter type may only be changed to a compatible or less specific
316+ .. [4 ]Theargument type may only be changed to a compatible or less specific
283317 type. The following type changes are allowed:
284318
285319 =================== ==================================================================