Re: [RFC][Draft] Body-less __construct

From: Date: Tue, 11 May 2021 14:45:29 +0000
Subject: Re: [RFC][Draft] Body-less __construct
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-114392@lists.php.net to get a copy of this message
Le 11/05/2021 à 16:39, Chase Peeler a écrit :
I agree. I think making things inconsistent between constructors and other methods is something that can be lived with - there are already other things special about constructors that don't apply to other methods - but we should at least allow consistency among constructors and allow the trailing semicolon in all cases.
As Sara stated, the example of the singleton final constructor is a good one, but another one I could think about which applies to *all methods* is when implementing an interface, you may want to keep some of the implemented methods just empty. Why not applying the semicolon syntax as well for all methods ? It doesn't seem like bad idea to me, I often write empty methods when implementing the null object pattern, or when I have partial implementations for specific use case, or just when I don't need to implement an abstract or interface method. I'm all in for consistency between constructor and all methods and allow the semicolon to replace any empty method body. Regards, Pierre

Thread (34 messages)

« previous php.internals (#114392) next »