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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to