File tree 1 file changed +25
-2
lines changed
1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -181,11 +181,34 @@ Change return type Yes [1]_ [2]_ No
181
181
.. [1 ] Should be avoided. When done, this change must be documented in the
182
182
UGPRADE file.
183
183
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
+ =================== ==================================================================
186
199
187
200
.. [3 ] When changing the parent class, the original parent class must remain an
188
201
ancestor of the class.
189
202
190
203
.. [4 ] A type hint may only be added if passing a value with a different type
191
204
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
You can’t perform that action at this time.
0 commit comments