Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-05-11 Thread Nikita Popov
On Mon, May 11, 2020 at 5:26 PM Dan Ackroyd wrote: > On Mon, 11 May 2020 at 10:52, Nikita Popov wrote: > > > > Please tell me if you have further concerns > > Question - as this is just sugar, presumably it doesn't add much > complexity to the PHP engine? > Yes, the implementation complexity

Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-05-11 Thread Dan Ackroyd
On Mon, 11 May 2020 at 10:52, Nikita Popov wrote: > > Please tell me if you have further concerns Question - as this is just sugar, presumably it doesn't add much complexity to the PHP engine? Vague concern - because it's a novel syntax, I find it hard to read, particularly when there are

Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-05-06 Thread Larry Garfield
On Wed, May 6, 2020, at 3:31 AM, Nikita Popov wrote: > On Tue, May 5, 2020 at 10:27 PM Larry Garfield > wrote: > > > On Tue, May 5, 2020, at 7:35 AM, Nikita Popov wrote: > > > > > > > Performing validation when the getAttributes() call is performed does > > sound > > > reasonable to me. We can

Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-05-06 Thread Nikita Popov
On Tue, May 5, 2020 at 10:27 PM Larry Garfield wrote: > On Tue, May 5, 2020, at 7:35 AM, Nikita Popov wrote: > > > > Performing validation when the getAttributes() call is performed does > sound > > reasonable to me. We can also add a class flag to perform this validation > > only once (if it is

Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-05-05 Thread Larry Garfield
On Tue, May 5, 2020, at 7:35 AM, Nikita Popov wrote: > Performing validation when the getAttributes() call is performed does sound > reasonable to me. We can also add a class flag to perform this validation > only once (if it is successful), so the cost doesn't have to be paid by > every single

Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-05-05 Thread Nikita Popov
On Wed, Apr 29, 2020 at 11:27 AM Benjamin Eberlei wrote: > > > On Wed, Apr 29, 2020 at 11:07 AM Nikita Popov > wrote: > >> On Wed, Apr 29, 2020 at 10:56 AM Benjamin Eberlei >> wrote: >> >>> >>> >>> On Wed, Apr 29, 2020 at 9:47 AM Nicolas Grekas < >>> nicolas.grekas+...@gmail.com> wrote: >>>

Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-04-29 Thread Benjamin Eberlei
On Wed, Apr 29, 2020 at 11:07 AM Nikita Popov wrote: > On Wed, Apr 29, 2020 at 10:56 AM Benjamin Eberlei > wrote: > >> >> >> On Wed, Apr 29, 2020 at 9:47 AM Nicolas Grekas < >> nicolas.grekas+...@gmail.com> wrote: >> >>> > I think it might be best to apply to "both" and provide an isPromoted()

Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-04-29 Thread Nikita Popov
On Wed, Apr 29, 2020 at 10:56 AM Benjamin Eberlei wrote: > > > On Wed, Apr 29, 2020 at 9:47 AM Nicolas Grekas < > nicolas.grekas+...@gmail.com> wrote: > >> > I think it might be best to apply to "both" and provide an isPromoted() >> > method on both ReflectionParameter and ReflectionProperty.

Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-04-29 Thread Benjamin Eberlei
On Wed, Apr 29, 2020 at 9:47 AM Nicolas Grekas wrote: > > I think it might be best to apply to "both" and provide an isPromoted() > > method on both ReflectionParameter and ReflectionProperty. Any code that > > wishes to validate the allowed positions of an attribute can then skip > >

Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-04-29 Thread Nicolas Grekas
> I think it might be best to apply to "both" and provide an isPromoted() > method on both ReflectionParameter and ReflectionProperty. Any code that > wishes to validate the allowed positions of an attribute can then skip > properties/parameters that report isPromoted() as true, to avoid reporting

Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-04-29 Thread Nikita Popov
On Wed, Apr 29, 2020 at 2:05 AM Larry Garfield wrote: > On Tue, Apr 28, 2020, at 10:56 AM, Nicolas Grekas wrote: > > > > > > > I would expect attributes to apply only to the properties on my side. > > > > > > Parameter annotations could be interesting for dependency injection. > > > Symfony

Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-04-28 Thread Larry Garfield
On Tue, Apr 28, 2020, at 10:56 AM, Nicolas Grekas wrote: > > > > > I would expect attributes to apply only to the properties on my side. > > > > Parameter annotations could be interesting for dependency injection. > > Symfony currently has some DI magic through parameter names among > > other

Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-04-28 Thread Nicolas Grekas
> > > I would expect attributes to apply only to the properties on my side. > > Parameter annotations could be interesting for dependency injection. > Symfony currently has some DI magic through parameter names among > other things. It might be nice to control these through annotations > instead.

Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-04-28 Thread Ilija Tovilo
Hi Nicolas > I would expect attributes to apply only to the properties on my side. Parameter annotations could be interesting for dependency injection. Symfony currently has some DI magic through parameter names among other things. It might be nice to control these through annotations instead.

Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-04-28 Thread Nicolas Grekas
> On Thu, Mar 26, 2020 at 2:30 PM Nikita Popov wrote: > > > Hi internals, > > > > 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,

Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion

2020-04-14 Thread Nikita Popov
On Tue, Apr 14, 2020 at 9:17 PM Dmitry Stogov wrote: > Hi Nikita, > > Personally, I don't see a big reason in introduction this syntax sugar. > It allows to make class declaration more compact but less readable. > > Also, this feature doesn't work well with inheritance. RFC doesn't provide > any