@@ -143,6 +143,41 @@ covered by our backward compatibility promise:
143
143
| Access a private property (via Reflection) | No |
144
144
+-----------------------------------------------+-----------------------------+
145
145
146
+ Using our Traits
147
+ ~~~~~~~~~~~~~~~~
148
+
149
+ All traits provided by Symfony may be used in your classes.
150
+
151
+ .. caution ::
152
+
153
+ The exception to this rule are traits tagged with ``@internal ``. Such
154
+ traits should not be used.
155
+
156
+ To be on the safe side, check the following table to know which use cases are
157
+ covered by our backward compatibility promise:
158
+
159
+ +-----------------------------------------------+-----------------------------+
160
+ | Use Case | Backward Compatibility |
161
+ +===============================================+=============================+
162
+ | **If you... ** | **Then we guarantee BC... ** |
163
+ +-----------------------------------------------+-----------------------------+
164
+ | Use a trait | Yes |
165
+ +-----------------------------------------------+-----------------------------+
166
+ | **If you use the trait and... ** | **Then we guarantee BC... ** |
167
+ +-----------------------------------------------+-----------------------------+
168
+ | Use it to implement an interface | Yes |
169
+ +-----------------------------------------------+-----------------------------+
170
+ | Use it to implement an abstract method | Yes |
171
+ +-----------------------------------------------+-----------------------------+
172
+ | Use it to extend a parent class | Yes |
173
+ +-----------------------------------------------+-----------------------------+
174
+ | Use it to define an abstract class | Yes |
175
+ +-----------------------------------------------+-----------------------------+
176
+ | Use a public, protected or private property | Yes |
177
+ +-----------------------------------------------+-----------------------------+
178
+ | Use a public, protected or private method | Yes |
179
+ +-----------------------------------------------+-----------------------------+
180
+
146
181
Working on Symfony Code
147
182
-----------------------
148
183
@@ -178,6 +213,9 @@ Change argument type No
178
213
Add return type No
179
214
Remove return type No [9 ]_
180
215
Change return type No
216
+ **Static Methods **
217
+ Turn non static into static No
218
+ Turn static into non static No
181
219
**Constants **
182
220
Add constant Yes
183
221
Remove constant No
@@ -209,21 +247,28 @@ Move to parent class Yes
209
247
Add protected property Yes
210
248
Remove protected property No [7 ]_
211
249
Reduce visibility No [7 ]_
250
+ Make public No [7 ]_
212
251
Move to parent class Yes
213
252
**Private Properties **
214
253
Add private property Yes
254
+ Make public or protected Yes
215
255
Remove private property Yes
216
256
**Constructors **
217
257
Add constructor without mandatory arguments Yes [1 ]_
218
258
Remove constructor No
219
259
Reduce visibility of a public constructor No
220
260
Reduce visibility of a protected constructor No [7 ]_
221
261
Move to parent class Yes
262
+ **Destructors **
263
+ Add destructor Yes
264
+ Remove destructor No
265
+ Move to parent class Yes
222
266
**Public Methods **
223
267
Add public method Yes
224
268
Remove public method No
225
269
Change name No
226
270
Reduce visibility No
271
+ Make final No [6 ]_
227
272
Move to parent class Yes
228
273
Add argument without a default value No
229
274
Add argument with a default value No [7 ]_ [8 ]_
@@ -241,6 +286,8 @@ Add protected method Yes
241
286
Remove protected method No [7 ]_
242
287
Change name No [7 ]_
243
288
Reduce visibility No [7 ]_
289
+ Make final No [6 ]_
290
+ Make public No [7 ]_ [8 ]_
244
291
Move to parent class Yes
245
292
Add argument without a default value No [7 ]_
246
293
Add argument with a default value No [7 ]_ [8 ]_
@@ -257,6 +304,7 @@ Change return type No [7]_ [8]_
257
304
Add private method Yes
258
305
Remove private method Yes
259
306
Change name Yes
307
+ Make public or protected Yes
260
308
Add argument without a default value Yes
261
309
Add argument with a default value Yes
262
310
Remove argument Yes
@@ -268,7 +316,7 @@ Change argument type Yes
268
316
Add return type Yes
269
317
Remove return type Yes
270
318
Change return type Yes
271
- **Static Methods **
319
+ **Static Methods and Properties **
272
320
Turn non static into static No [7 ]_ [8 ]_
273
321
Turn static into non static No
274
322
**Constants **
@@ -277,6 +325,91 @@ Remove constant No
277
325
Change value of a constant Yes [1 ]_ [5 ]_
278
326
================================================== ==============
279
327
328
+ Changing Traits
329
+ ~~~~~~~~~~~~~~~
330
+
331
+ This table tells you which changes you are allowed to do when working on
332
+ Symfony's traits:
333
+
334
+ ================================================== ==============
335
+ Type of Change Change Allowed
336
+ ================================================== ==============
337
+ Remove entirely No
338
+ Change name or namespace No
339
+ Use another trait Yes
340
+ **Public Properties **
341
+ Add public property Yes
342
+ Remove public property No
343
+ Reduce visibility No
344
+ Move to a used trait Yes
345
+ **Protected Properties **
346
+ Add protected property Yes
347
+ Remove protected property No
348
+ Reduce visibility No
349
+ Make public No
350
+ Move to a used trait Yes
351
+ **Private Properties **
352
+ Add private property Yes
353
+ Remove private property No
354
+ Make public or protected Yes
355
+ Move to a used trait Yes
356
+ **Constructors and destructors **
357
+ Have constructor or destructor No
358
+ **Public Methods **
359
+ Add public method Yes
360
+ Remove public method No
361
+ Change name No
362
+ Reduce visibility No
363
+ Make final No [6 ]_
364
+ Move to used trait Yes
365
+ Add argument without a default value No
366
+ Add argument with a default value No
367
+ Remove argument No
368
+ Add default value to an argument No
369
+ Remove default value of an argument No
370
+ Add type hint to an argument No
371
+ Remove type hint of an argument No
372
+ Change argument type No
373
+ Change return type No
374
+ **Protected Methods **
375
+ Add protected method Yes
376
+ Remove protected method No
377
+ Change name No
378
+ Reduce visibility No
379
+ Make final No [6 ]_
380
+ Make public No [8 ]_
381
+ Move to used trait Yes
382
+ Add argument without a default value No
383
+ Add argument with a default value No
384
+ Remove argument No
385
+ Add default value to an argument No
386
+ Remove default value of an argument No
387
+ Add type hint to an argument No
388
+ Remove type hint of an argument No
389
+ Change argument type No
390
+ Change return type No
391
+ **Private Methods **
392
+ Add private method Yes
393
+ Remove private method No
394
+ Change name No
395
+ Make public or protected Yes
396
+ Move to used trait Yes
397
+ Add argument without a default value No
398
+ Add argument with a default value No
399
+ Remove argument No
400
+ Add default value to an argument No
401
+ Remove default value of an argument No
402
+ Add type hint to an argument No
403
+ Remove type hint of an argument No
404
+ Change argument type No
405
+ Add return type No
406
+ Remove return type No
407
+ Change return type No
408
+ **Static Methods and Properties **
409
+ Turn non static into static No
410
+ Turn static into non static No
411
+ ================================================== ==============
412
+
280
413
.. [1 ] Should be avoided. When done, this change must be documented in the
281
414
UPGRADE file.
282
415
0 commit comments