Skip to content

Commit 72d416c

Browse files
Add BC promise rules for constructors
1 parent 45c72ff commit 72d416c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

contributing/code/bc.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,14 @@ Make public or protected Yes
258258
Remove private property Yes
259259
**Constructors**
260260
Add constructor without mandatory arguments Yes :ref:`[1] <note-1>`
261+
:ref:`Add argument without a default value <add-argument-public-method>` No
262+
Add argument with a default value Yes :ref:`[11] <note-11>`
263+
Remove argument No :ref:`[3] <note-3>`
264+
Add default value to an argument Yes
265+
Remove default value of an argument No
266+
Add type hint to an argument No
267+
Remove type hint of an argument Yes
268+
Change argument type No
261269
Remove constructor No
262270
Reduce visibility of a public constructor No
263271
Reduce visibility of a protected constructor No :ref:`[7] <note-7>`
@@ -473,6 +481,10 @@ a return type is only possible with a child type.
473481
constructors of Attribute classes. Using PHP named arguments might break your
474482
code when upgrading to newer Symfony versions.
475483

484+
.. _note-11:
485+
486+
**[11]** Only optional argument(s) of a constructor at last position may be added.
487+
476488
Making Code Changes in a Backward Compatible Way
477489
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
478490

0 commit comments

Comments
 (0)