@@ -132,6 +132,41 @@ covered by our backward compatibility promise:
132
132
| Access a private property (via Reflection) | No |
133
133
+-----------------------------------------------+-----------------------------+
134
134
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
+
135
170
Working on Symfony Code
136
171
-----------------------
137
172
@@ -165,6 +200,9 @@ Add type hint to an argument No
165
200
Remove type hint of an argument No
166
201
Change argument type No
167
202
Change return type No
203
+ **Static Methods **
204
+ Turn non static into static No
205
+ Turn static into non static No
168
206
**Constants **
169
207
Add constant Yes
170
208
Remove constant No
@@ -196,21 +234,28 @@ Move to parent class Yes
196
234
Add protected property Yes
197
235
Remove protected property No [7 ]_
198
236
Reduce visibility No [7 ]_
237
+ Make public Yes
199
238
Move to parent class Yes
200
239
**Private Properties **
201
240
Add private property Yes
241
+ Make public or protected Yes
202
242
Remove private property Yes
203
243
**Constructors **
204
244
Add constructor without mandatory arguments Yes [1 ]_
205
245
Remove constructor No
206
246
Reduce visibility of a public constructor No
207
247
Reduce visibility of a protected constructor No [7 ]_
208
248
Move to parent class Yes
249
+ **Destructors **
250
+ Add destructor Yes
251
+ Remove destructor No
252
+ Move to parent class Yes
209
253
**Public Methods **
210
254
Add public method Yes
211
255
Remove public method No
212
256
Change name No
213
257
Reduce visibility No
258
+ Make final No [6 ]_
214
259
Move to parent class Yes
215
260
Add argument without a default value No
216
261
Add argument with a default value No [7 ]_ [8 ]_
@@ -226,6 +271,8 @@ Add protected method Yes
226
271
Remove protected method No [7 ]_
227
272
Change name No [7 ]_
228
273
Reduce visibility No [7 ]_
274
+ Make final No [6 ]_
275
+ Make public Yes
229
276
Move to parent class Yes
230
277
Add argument without a default value No [7 ]_
231
278
Add argument with a default value No [7 ]_ [8 ]_
@@ -240,6 +287,7 @@ Change return type No [7]_ [8]_
240
287
Add private method Yes
241
288
Remove private method Yes
242
289
Change name Yes
290
+ Make public or protected Yes
243
291
Add argument without a default value Yes
244
292
Add argument with a default value Yes
245
293
Remove argument Yes
@@ -249,7 +297,7 @@ Add type hint to an argument Yes
249
297
Remove type hint of an argument Yes
250
298
Change argument type Yes
251
299
Change return type Yes
252
- **Static Methods **
300
+ **Static Methods and Properties **
253
301
Turn non static into static No [7 ]_ [8 ]_
254
302
Turn static into non static No
255
303
**Constants **
@@ -258,6 +306,91 @@ Remove constant No
258
306
Change value of a constant Yes [1 ]_ [5 ]_
259
307
================================================== ==============
260
308
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
+
261
394
.. [1 ] Should be avoided. When done, this change must be documented in the
262
395
UPGRADE file.
263
396
0 commit comments