Re: Attributes on property groups

From: Date: Tue, 22 Sep 2020 13:23:14 +0000
Subject: Re: Attributes on property groups
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-111918@lists.php.net to get a copy of this message
And why would we want to do that? On Tue, Sep 22, 2020, 4:04 PM Marco Pivetta <ocramius@gmail.com> wrote: > Probably easier/simpler to deprecate (then remove) property declaration > groups, no? > > On Tue, Sep 22, 2020, 14:51 Nikita Popov <nikita.ppv@gmail.com> wrote: > > > Hi internals, > > > > Currently, placing an attribute on property (or constant) groups is not > > allowed: > > > > class Foo { > > #[NonNegative] > > public int $x, $y, $z; > > } > > // Fatal error: Cannot apply attributes to a group of properties > > > > This is a case that was not explicitly mentioned in the RFC and we > decided > > to be conversative when landing the initial implementation. > > > > However, this restriction seems pretty arbitrary to me, and I think we > > should remove it. While there is some potential ambiguity as to whether > the > > attribute applies to all properties or only the first one, I think the > > general expectation is that it should apply to all properties, just like > > the property type does. > > > > PR to allow this: https://github.com/php/php-src/pull/6186 > > > > Any thoughts on this? > > > > Regards, > > Nikita > > >

« previous php.internals (#111918) next »