On Thu, Apr 2, 2020 at 1:35 AM Markus Fischer <mar...@fischer.name> wrote:

> Hi,
> On 2020-03-26 14:30, Nikita Popov wrote:
> > I would like to submit the following RFC for your consideration:
> > https://wiki.php.net/rfc/constructor_promotion
> >
> > This is based on one off the suggestions made in
> > https://externals.io/message/109220, and some existing discussion on the
> > topic can be found in that thread.
> >
> > The primary motivation for this feature is to close the currently rather
> > wide gap between the use of ad-hoc array structures, and the use of
> > well-defined and type-safe value objects. The latter is what we want
> people
> > to use, but the former is, unfortunately, what is *easy* to use.
>
> The amount of boilerplate this would cut down for e.g. projects using DI
> and DTOs is unfathomable.
>
> How does this work together with reflection? Will reflection see the
> properties _and_ the extended constructor definitions?
>

Reflection will see the state after desugaring. That is, it just sees
normal properties and normal constructor args. I've made this more explicit
in the RFC now: https://wiki.php.net/rfc/constructor_promotion#reflection

Nikita

Reply via email to