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 79ca9f7

Browse filesBrowse files
committed
Added information about type compatibility
1 parent dacd7ce commit 79ca9f7
Copy full SHA for 79ca9f7

File tree

Expand file treeCollapse file tree

1 file changed

+25
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+25
-2
lines changed

‎contributing/code/bc.rst

Copy file name to clipboardExpand all lines: contributing/code/bc.rst
+25-2Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,34 @@ Change return type Yes [1]_ [2]_ No
181181
.. [1] Should be avoided. When done, this change must be documented in the
182182
UGPRADE file.
183183
184-
.. [2] The return type may only be changed to compatible types. **TODO define
185-
type compatibility**
184+
.. [2] The return type may only be changed to compatible types. The following
185+
type changes are allowed:
186+
187+
=================== ==================================================================
188+
Original Type New Type
189+
=================== ==================================================================
190+
boolean any `scalar type`_ with equivalent `boolean values`_
191+
string any `scalar type`_ or object with equivalent `string values`_
192+
integer any `scalar type`_ with equivalent `integer values`_
193+
float any `scalar type`_ with equivalent `float values`_
194+
array instance of ``ArrayAccess``, ``Traversable`` and ``Countable``
195+
``ArrayAccess`` array
196+
``Traversable`` array
197+
``Countable`` array
198+
=================== ==================================================================
186199
187200
.. [3] When changing the parent class, the original parent class must remain an
188201
ancestor of the class.
189202
190203
.. [4] A type hint may only be added if passing a value with a different type
191204
previously generated a fatal error.
205+
206+
.. _scalar type: http://php.net/manual/en/function.is-scalar.php
207+
208+
.. _boolean values: http://php.net/manual/en/function.boolval.php
209+
210+
.. _string values: http://www.php.net/manual/en/function.strval.php
211+
212+
.. _integer values: http://www.php.net/manual/en/function.intval.php
213+
214+
.. _float values: http://www.php.net/manual/en/function.floatval.php

0 commit comments

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