Skip to content

Commit 31cd921

Browse files
Add traits to BC policy
1 parent 3c88886 commit 31cd921

File tree

1 file changed

+134
-1
lines changed

1 file changed

+134
-1
lines changed

contributing/code/bc.rst

Lines changed: 134 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,41 @@ covered by our backward compatibility promise:
132132
| Access a private property (via Reflection) | No |
133133
+-----------------------------------------------+-----------------------------+
134134

135+
Using our Traits
136+
~~~~~~~~~~~~~~~~
137+
138+
All traits provided by Symfony may be used in your classes.
139+
140+
.. caution::
141+
142+
The exception to this rule are traits tagged with ``@internal``. Such
143+
traits should not be used.
144+
145+
To be on the safe side, check the following table to know which use cases are
146+
covered by our backward compatibility promise:
147+
148+
+-----------------------------------------------+-----------------------------+
149+
| Use Case | Backward Compatibility |
150+
+===============================================+=============================+
151+
| **If you...** | **Then we guarantee BC...** |
152+
+-----------------------------------------------+-----------------------------+
153+
| Use a trait | Yes |
154+
+-----------------------------------------------+-----------------------------+
155+
| **If you use the trait and...** | **Then we guarantee BC...** |
156+
+-----------------------------------------------+-----------------------------+
157+
| Use it to implement an interface | Yes |
158+
+-----------------------------------------------+-----------------------------+
159+
| Use it to implement an abstract method | Yes |
160+
+-----------------------------------------------+-----------------------------+
161+
| Use it to extend a parent class | Yes |
162+
+-----------------------------------------------+-----------------------------+
163+
| Use it to define an abstract class | Yes |
164+
+-----------------------------------------------+-----------------------------+
165+
| Use a public, protected or private property | Yes |
166+
+-----------------------------------------------+-----------------------------+
167+
| Use a public, protected or private method | Yes |
168+
+-----------------------------------------------+-----------------------------+
169+
135170
Working on Symfony Code
136171
-----------------------
137172

@@ -165,6 +200,9 @@ Add type hint to an argument No
165200
Remove type hint of an argument No
166201
Change argument type No
167202
Change return type No
203+
**Static Methods**
204+
Turn non static into static No
205+
Turn static into non static No
168206
**Constants**
169207
Add constant Yes
170208
Remove constant No
@@ -196,21 +234,28 @@ Move to parent class Yes
196234
Add protected property Yes
197235
Remove protected property No [7]_
198236
Reduce visibility No [7]_
237+
Make public Yes
199238
Move to parent class Yes
200239
**Private Properties**
201240
Add private property Yes
241+
Make public or protected Yes
202242
Remove private property Yes
203243
**Constructors**
204244
Add constructor without mandatory arguments Yes [1]_
205245
Remove constructor No
206246
Reduce visibility of a public constructor No
207247
Reduce visibility of a protected constructor No [7]_
208248
Move to parent class Yes
249+
**Destructors**
250+
Add destructor Yes
251+
Remove destructor No
252+
Move to parent class Yes
209253
**Public Methods**
210254
Add public method Yes
211255
Remove public method No
212256
Change name No
213257
Reduce visibility No
258+
Make final No [6]_
214259
Move to parent class Yes
215260
Add argument without a default value No
216261
Add argument with a default value No [7]_ [8]_
@@ -226,6 +271,8 @@ Add protected method Yes
226271
Remove protected method No [7]_
227272
Change name No [7]_
228273
Reduce visibility No [7]_
274+
Make final No [6]_
275+
Make public Yes
229276
Move to parent class Yes
230277
Add argument without a default value No [7]_
231278
Add argument with a default value No [7]_ [8]_
@@ -240,6 +287,7 @@ Change return type No [7]_ [8]_
240287
Add private method Yes
241288
Remove private method Yes
242289
Change name Yes
290+
Make public or protected Yes
243291
Add argument without a default value Yes
244292
Add argument with a default value Yes
245293
Remove argument Yes
@@ -249,7 +297,7 @@ Add type hint to an argument Yes
249297
Remove type hint of an argument Yes
250298
Change argument type Yes
251299
Change return type Yes
252-
**Static Methods**
300+
**Static Methods and Properties**
253301
Turn non static into static No [7]_ [8]_
254302
Turn static into non static No
255303
**Constants**
@@ -258,6 +306,91 @@ Remove constant No
258306
Change value of a constant Yes [1]_ [5]_
259307
================================================== ==============
260308

309+
Changing Traits
310+
~~~~~~~~~~~~~~~
311+
312+
This table tells you which changes you are allowed to do when working on
313+
Symfony's traits:
314+
315+
================================================== ==============
316+
Type of Change Change Allowed
317+
================================================== ==============
318+
Remove entirely No
319+
Change name or namespace No
320+
Use another trait Yes
321+
**Public Properties**
322+
Add public property Yes
323+
Remove public property No
324+
Reduce visibility No
325+
Move to a used trait Yes
326+
**Protected Properties**
327+
Add protected property Yes
328+
Remove protected property No
329+
Reduce visibility No
330+
Make public Yes
331+
Move to a used trait Yes
332+
**Private Properties**
333+
Add private property Yes
334+
Remove private property No
335+
Make public or protected Yes
336+
Move to a used trait Yes
337+
**Constructors and destructors**
338+
Have constructor or destructor No
339+
**Public Methods**
340+
Add public method Yes
341+
Remove public method No
342+
Change name No
343+
Reduce visibility No
344+
Make final No [6]_
345+
Move to used trait Yes
346+
Add argument without a default value No
347+
Add argument with a default value No
348+
Remove argument No
349+
Add default value to an argument No
350+
Remove default value of an argument No
351+
Add type hint to an argument No
352+
Remove type hint of an argument No
353+
Change argument type No
354+
Change return type No
355+
**Protected Methods**
356+
Add protected method Yes
357+
Remove protected method No
358+
Change name No
359+
Reduce visibility No
360+
Make final No [6]_
361+
Make public Yes
362+
Move to used trait Yes
363+
Add argument without a default value No
364+
Add argument with a default value No
365+
Remove argument No
366+
Add default value to an argument No
367+
Remove default value of an argument No
368+
Add type hint to an argument No
369+
Remove type hint of an argument No
370+
Change argument type No
371+
Change return type No
372+
**Private Methods**
373+
Add private method Yes
374+
Remove private method No
375+
Change name No
376+
Make public or protected Yes
377+
Move to used trait Yes
378+
Add argument without a default value No
379+
Add argument with a default value No
380+
Remove argument No
381+
Add default value to an argument No
382+
Remove default value of an argument No
383+
Add type hint to an argument No
384+
Remove type hint of an argument No
385+
Change argument type No
386+
Add return type No
387+
Remove return type No
388+
Change return type No
389+
**Static Methods and Properties**
390+
Turn non static into static No
391+
Turn static into non static No
392+
================================================== ==============
393+
261394
.. [1] Should be avoided. When done, this change must be documented in the
262395
UPGRADE file.
263396

0 commit comments

Comments
 (0)