rfc:constructor_return_type
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:constructor_return_type [2020/06/16 00:22] – updated RFC moliata | rfc:constructor_return_type [2020/06/17 10:04] (current) – mark as superseded cmb | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Author: Benas Seliuginas, < | * Author: Benas Seliuginas, < | ||
* Target version: PHP 8.0 | * Target version: PHP 8.0 | ||
- | * Status: | + | * Status: |
===== Introduction ===== | ===== Introduction ===== | ||
Line 48: | Line 48: | ||
</ | </ | ||
- | Moreover, it's important to remember that the constructor | + | Moreover, it's important to remember that the constructor is rather a regular function that can be called just like any other method (i.e. '' |
==== Documented as void ==== | ==== Documented as void ==== | ||
Line 54: | Line 54: | ||
==== __clone allows void return type ==== | ==== __clone allows void return type ==== | ||
- | Given that the [[https:// | + | Given that the [[https:// |
<code php> | <code php> | ||
Line 68: | Line 68: | ||
==== Consistency with other methods ==== | ==== Consistency with other methods ==== | ||
- | Basically, all (both regular and magic) methods allow to have an explicit return type. The only exceptions: constructors and destructors. As Kalle has pointed out, it is a finger habbit to type a return type after every method and could see himself write this as a style. | + | Basically, all (both regular and magic) methods allow to have an explicit return type. The only exceptions |
+ | |||
+ | As [[https:// | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== |
rfc/constructor_return_type.1592266921.txt.gz · Last modified: 2020/06/16 00:22 by moliata