On Mon, 10 May 2021 at 21:59, Larry Garfield <la...@garfieldtech.com> wrote:

> 1) Please don't top-post.
>
> 2) The reason is that the old way doesn't provide any way to populate them
> on construction.  The pattern of "assign the arg to the prop in the
> constructor" is stupendously common, and promotion makes it vastly more
> convenient.
>
> For more details:
>
> https://platform.sh/blog/2020/php-80-feature-focus-constructor-property-promotion/
>
> The constructor isn't "supposed" to be empty.  It just often is with
> promotion, because the constructor wasn't doing anything else besides
> shuffling its parameters over to properties, which is now automatic.
>
> --Larry Garfield
>
>
Sorry for top-posting. Didn't know what it means :), also it was kind of my
first reply to mailing list.

Yes, I see now. I had forgotten that bit when I replied; apologies.
I guess it makes sense now to end the constructor with a semicolon when it
holds no body.

Reply via email to