Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0c6420f

Browse filesBrowse files
committed
Added information about changing parameter types
1 parent 6501a35 commit 0c6420f
Copy full SHA for 0c6420f

File tree

Expand file treeCollapse file tree

1 file changed

+26
-9
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+26
-9
lines changed

‎contributing/code/bc.rst

Copy file name to clipboardExpand all lines: contributing/code/bc.rst
+26-9Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ Add default value to a parameter Yes [2]_ No
194194
Remove default value of a parameter No No
195195
Add type hint to a parameter No No
196196
Remove type hint of a parameter Yes [2]_ No
197-
Change return type Yes [2]_ [4]_ No
197+
Change parameter type Yes [2]_ [4]_ No
198+
Change return type Yes [2]_ [5]_ No
198199
============================================== ============== ==============
199200

200201

@@ -211,7 +212,7 @@ Remove entirely No No
211212
Make final Yes [2]_ No
212213
Make abstract No No
213214
Change name or namespace No No
214-
Change parent class Yes [5]_ Yes [5]_
215+
Change parent class Yes [6]_ Yes [6]_
215216
Add interface Yes Yes
216217
Remove interface No No
217218
**Public Properties**
@@ -237,9 +238,10 @@ Add parameter with a default value Yes [2]_ No
237238
Remove parameter Yes [3]_ Yes [3]_
238239
Add default value to a parameter Yes [2]_ No
239240
Remove default value of a parameter No No
240-
Add type hint to a parameter Yes [6]_ No
241+
Add type hint to a parameter Yes [7]_ No
241242
Remove type hint of a parameter Yes [2]_ No
242-
Change return type Yes [2]_ [4]_ No
243+
Change parameter type Yes [2]_ [4]_ No
244+
Change return type Yes [2]_ [5]_ No
243245
**Protected Methods**
244246
Add protected method Yes Yes
245247
Remove protected method Yes [2]_ No
@@ -252,7 +254,8 @@ Add default value to a parameter Yes [2]_ No
252254
Remove default value of a parameter Yes [2]_ No
253255
Add type hint to a parameter Yes [2]_ No
254256
Remove type hint of a parameter Yes [2]_ No
255-
Change return type Yes [2]_ [4]_ No
257+
Change parameter type Yes [2]_ [4]_ No
258+
Change return type Yes [2]_ [5]_ No
256259
================================================== ============== ==============
257260

258261

@@ -264,8 +267,22 @@ Change return type Yes [2]_ [4]_ No
264267
265268
.. [3] Only the last parameter(s) of a method may be removed.
266269
267-
.. [4] The return type may only be changed to compatible types. The following
268-
type changes are allowed:
270+
.. [4] The parameter type may only be changed to a compatible or less specific
271+
type. The following type changes are allowed:
272+
273+
=================== ==================================================================
274+
Original Type New Type
275+
=================== ==================================================================
276+
boolean any `scalar type`_ with equivalent `boolean values`_
277+
string any `scalar type`_ or object with equivalent `string values`_
278+
integer any `scalar type`_ with equivalent `integer values`_
279+
float any `scalar type`_ with equivalent `float values`_
280+
class ``<C>`` any superclass or interface of ``<C>``
281+
interface ``<I>`` any superinterface of ``<I>``
282+
=================== ==================================================================
283+
284+
.. [5] The return type may only be changed to a compatible or more specific
285+
type. The following type changes are allowed:
269286
270287
=================== ==================================================================
271288
Original Type New Type
@@ -282,10 +299,10 @@ Change return type Yes [2]_ [4]_ No
282299
interface ``<I>`` any subinterface or implementing class of ``<I>``
283300
=================== ==================================================================
284301
285-
.. [5] When changing the parent class, the original parent class must remain an
302+
.. [6] When changing the parent class, the original parent class must remain an
286303
ancestor of the class.
287304
288-
.. [6] A type hint may only be added if passing a value with a different type
305+
.. [7] A type hint may only be added if passing a value with a different type
289306
previously generated a fatal error.
290307
291308
.. _scalar type: http://php.net/manual/en/function.is-scalar.php

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.