Skip to content

Commit 55f7308

Browse files
committed
minor #20307 Add BC promise rules for constructors (alexandre-daubois)
This PR was merged into the 5.4 branch. Discussion ---------- Add BC promise rules for constructors As spotted in symfony/symfony#58490, following symfony/symfony#58490 (comment) Commits ------- 72d416c Add BC promise rules for constructors
2 parents 3b9116e + 72d416c commit 55f7308

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

contributing/code/bc.rst

+12
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)