Re: Optional constructor body
| From: | Rob Landers | Date: | Thu, 18 Jul 2024 13:12:23 +0000 |
| Subject: | Re: Optional constructor body | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-124476@lists.php.net to get a copy of this message | ||
On Thu, Jul 18, 2024, at 12:11, Oliver Nybroe wrote:
> Thanks for sharing previous discussions, I will definitely take a look at those before writing
> up the RFC.
>
>
> > If you do with to go with an RFC, I'd like to see if your proposal
> addresses whether this syntax should implicitly call
>
parent::__construct(), and if a semi colon is expected or not
> (public function __construct(public int $foo); vs `public
> function
> __construct(public int $foo)`).
> Thank you, these are very valuable points to address in the RFC.
>
> I can definitely feel that there will be some mixed opinions about semicolon vs no semi colon.
>
>
> Best regards
> Oliver Nybroe (he/him)
Don't forget to bottom post :)
I have a feeling a semi-colon is going to be required to disambiguate:
public function __construct(protected string $foo) protected string $bar;
Without semi-colons, that is perfectly valid and confusing.
— Rob