rfc:constructor_return_type
This is an old revision of the document!
PHP RFC: Allow void return type on constructors/destructors
- Date: 2020-06-14
- Author: Benas Seliuginas, benas.molis.iml@gmail.com
- Status: Draft
- Target version: PHP 8.0
Introduction
RFC proposes to allow using void
return type on constructors and destructors (e. g. for alternative code style, consistency with other methods, etc.). In a way, this RFC is like a trailing comma: some might use it, some might not, but both cases are valid and allowed.
Proposal
Backward Incompatible Changes
None.
To ensure backwards compatibility, it is allowed to not specify a return type at all. Although, since no return type is mixed|void
, it is not allowed to narrow the return type to mixed
, only void
.
Vote
2/3 majority Yes/No.
Implementation
rfc/constructor_return_type.1592163680.txt.gz · Last modified: 2020/06/14 19:41 by moliata