@@ -134,6 +134,41 @@ covered by our backward compatibility promise:
134134| Access a private property (via Reflection) | No |
135135+-----------------------------------------------+-----------------------------+
136136
137+ Using our Traits
138+ ~~~~~~~~~~~~~~~~
139+
140+ All traits provided by Symfony may be used in your classes.
141+
142+ .. caution ::
143+
144+ The exception to this rule are traits tagged with ``@internal ``. Such
145+ traits should not be used.
146+
147+ To be on the safe side, check the following table to know which use cases are
148+ covered by our backward compatibility promise:
149+
150+ +-----------------------------------------------+-----------------------------+
151+ | Use Case | Backward Compatibility |
152+ +===============================================+=============================+
153+ | **If you... ** | **Then we guarantee BC... ** |
154+ +-----------------------------------------------+-----------------------------+
155+ | Use a trait | Yes |
156+ +-----------------------------------------------+-----------------------------+
157+ | **If you use the trait and... ** | **Then we guarantee BC... ** |
158+ +-----------------------------------------------+-----------------------------+
159+ | Use it to implement an interface | Yes |
160+ +-----------------------------------------------+-----------------------------+
161+ | Use it to implement an abstract method | Yes |
162+ +-----------------------------------------------+-----------------------------+
163+ | Use it to extend a parent class | Yes |
164+ +-----------------------------------------------+-----------------------------+
165+ | Use it to define an abstract class | Yes |
166+ +-----------------------------------------------+-----------------------------+
167+ | Use a public, protected or private property | Yes |
168+ +-----------------------------------------------+-----------------------------+
169+ | Use a public, protected or private method | Yes |
170+ +-----------------------------------------------+-----------------------------+
171+
137172Working on Symfony Code
138173-----------------------
139174
@@ -169,6 +204,9 @@ Change argument type No
169204Add return type No
170205Remove return type No [9 ]_
171206Change return type No
207+ **Static Methods **
208+ Turn non static into static No
209+ Turn static into non static No
172210**Constants **
173211Add constant Yes
174212Remove constant No
@@ -200,21 +238,28 @@ Move to parent class Yes
200238Add protected property Yes
201239Remove protected property No [7 ]_
202240Reduce visibility No [7 ]_
241+ Make public No [7 ]_
203242Move to parent class Yes
204243**Private Properties **
205244Add private property Yes
245+ Make public or protected Yes
206246Remove private property Yes
207247**Constructors **
208248Add constructor without mandatory arguments Yes [1 ]_
209249Remove constructor No
210250Reduce visibility of a public constructor No
211251Reduce visibility of a protected constructor No [7 ]_
212252Move to parent class Yes
253+ **Destructors **
254+ Add destructor Yes
255+ Remove destructor No
256+ Move to parent class Yes
213257**Public Methods **
214258Add public method Yes
215259Remove public method No
216260Change name No
217261Reduce visibility No
262+ Make final No [6 ]_
218263Move to parent class Yes
219264Add argument without a default value No
220265Add argument with a default value No [7 ]_ [8 ]_
@@ -232,6 +277,8 @@ Add protected method Yes
232277Remove protected method No [7 ]_
233278Change name No [7 ]_
234279Reduce visibility No [7 ]_
280+ Make final No [6 ]_
281+ Make public No [7 ]_ [8 ]_
235282Move to parent class Yes
236283Add argument without a default value No [7 ]_
237284Add argument with a default value No [7 ]_ [8 ]_
@@ -248,6 +295,7 @@ Change return type No [7]_ [8]_
248295Add private method Yes
249296Remove private method Yes
250297Change name Yes
298+ Make public or protected Yes
251299Add argument without a default value Yes
252300Add argument with a default value Yes
253301Remove argument Yes
@@ -259,7 +307,7 @@ Change argument type Yes
259307Add return type Yes
260308Remove return type Yes
261309Change return type Yes
262- **Static Methods **
310+ **Static Methods and Properties **
263311Turn non static into static No [7 ]_ [8 ]_
264312Turn static into non static No
265313**Constants **
@@ -268,6 +316,91 @@ Remove constant No
268316Change value of a constant Yes [1 ]_ [5 ]_
269317================================================== ==============
270318
319+ Changing Traits
320+ ~~~~~~~~~~~~~~~
321+
322+ This table tells you which changes you are allowed to do when working on
323+ Symfony's traits:
324+
325+ ================================================== ==============
326+ Type of Change Change Allowed
327+ ================================================== ==============
328+ Remove entirely No
329+ Change name or namespace No
330+ Use another trait Yes
331+ **Public Properties **
332+ Add public property Yes
333+ Remove public property No
334+ Reduce visibility No
335+ Move to a used trait Yes
336+ **Protected Properties **
337+ Add protected property Yes
338+ Remove protected property No
339+ Reduce visibility No
340+ Make public No
341+ Move to a used trait Yes
342+ **Private Properties **
343+ Add private property Yes
344+ Remove private property No
345+ Make public or protected Yes
346+ Move to a used trait Yes
347+ **Constructors and destructors **
348+ Have constructor or destructor No
349+ **Public Methods **
350+ Add public method Yes
351+ Remove public method No
352+ Change name No
353+ Reduce visibility No
354+ Make final No [6 ]_
355+ Move to used trait Yes
356+ Add argument without a default value No
357+ Add argument with a default value No
358+ Remove argument No
359+ Add default value to an argument No
360+ Remove default value of an argument No
361+ Add type hint to an argument No
362+ Remove type hint of an argument No
363+ Change argument type No
364+ Change return type No
365+ **Protected Methods **
366+ Add protected method Yes
367+ Remove protected method No
368+ Change name No
369+ Reduce visibility No
370+ Make final No [6 ]_
371+ Make public No [8 ]_
372+ Move to used trait Yes
373+ Add argument without a default value No
374+ Add argument with a default value No
375+ Remove argument No
376+ Add default value to an argument No
377+ Remove default value of an argument No
378+ Add type hint to an argument No
379+ Remove type hint of an argument No
380+ Change argument type No
381+ Change return type No
382+ **Private Methods **
383+ Add private method Yes
384+ Remove private method No
385+ Change name No
386+ Make public or protected Yes
387+ Move to used trait Yes
388+ Add argument without a default value No
389+ Add argument with a default value No
390+ Remove argument No
391+ Add default value to an argument No
392+ Remove default value of an argument No
393+ Add type hint to an argument No
394+ Remove type hint of an argument No
395+ Change argument type No
396+ Add return type No
397+ Remove return type No
398+ Change return type No
399+ **Static Methods and Properties **
400+ Turn non static into static No
401+ Turn static into non static No
402+ ================================================== ==============
403+
271404.. [1 ] Should be avoided. When done, this change must be documented in the
272405 UPGRADE file.
273406
0 commit comments