@@ -134,6 +134,41 @@ covered by our backward compatibility promise:
134
134
| Access a private property (via Reflection) | No |
135
135
+-----------------------------------------------+-----------------------------+
136
136
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
+
137
172
Working on Symfony Code
138
173
-----------------------
139
174
@@ -169,6 +204,9 @@ Change argument type No
169
204
Add return type No
170
205
Remove return type No [9 ]_
171
206
Change return type No
207
+ **Static Methods **
208
+ Turn non static into static No
209
+ Turn static into non static No
172
210
**Constants **
173
211
Add constant Yes
174
212
Remove constant No
@@ -200,21 +238,28 @@ Move to parent class Yes
200
238
Add protected property Yes
201
239
Remove protected property No [7 ]_
202
240
Reduce visibility No [7 ]_
241
+ Make public No [7 ]_
203
242
Move to parent class Yes
204
243
**Private Properties **
205
244
Add private property Yes
245
+ Make public or protected Yes
206
246
Remove private property Yes
207
247
**Constructors **
208
248
Add constructor without mandatory arguments Yes [1 ]_
209
249
Remove constructor No
210
250
Reduce visibility of a public constructor No
211
251
Reduce visibility of a protected constructor No [7 ]_
212
252
Move to parent class Yes
253
+ **Destructors **
254
+ Add destructor Yes
255
+ Remove destructor No
256
+ Move to parent class Yes
213
257
**Public Methods **
214
258
Add public method Yes
215
259
Remove public method No
216
260
Change name No
217
261
Reduce visibility No
262
+ Make final No [6 ]_
218
263
Move to parent class Yes
219
264
Add argument without a default value No
220
265
Add argument with a default value No [7 ]_ [8 ]_
@@ -232,6 +277,8 @@ Add protected method Yes
232
277
Remove protected method No [7 ]_
233
278
Change name No [7 ]_
234
279
Reduce visibility No [7 ]_
280
+ Make final No [6 ]_
281
+ Make public No [7 ]_ [8 ]_
235
282
Move to parent class Yes
236
283
Add argument without a default value No [7 ]_
237
284
Add argument with a default value No [7 ]_ [8 ]_
@@ -248,6 +295,7 @@ Change return type No [7]_ [8]_
248
295
Add private method Yes
249
296
Remove private method Yes
250
297
Change name Yes
298
+ Make public or protected Yes
251
299
Add argument without a default value Yes
252
300
Add argument with a default value Yes
253
301
Remove argument Yes
@@ -259,7 +307,7 @@ Change argument type Yes
259
307
Add return type Yes
260
308
Remove return type Yes
261
309
Change return type Yes
262
- **Static Methods **
310
+ **Static Methods and Properties **
263
311
Turn non static into static No [7 ]_ [8 ]_
264
312
Turn static into non static No
265
313
**Constants **
@@ -268,6 +316,91 @@ Remove constant No
268
316
Change value of a constant Yes [1 ]_ [5 ]_
269
317
================================================== ==============
270
318
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
+
271
404
.. [1 ] Should be avoided. When done, this change must be documented in the
272
405
UPGRADE file.
273
406
0 commit comments