On Tue, Mar 29, 2016 at 5:16 PM, Levi Morrison <le...@php.net> wrote:
> > 2) The handling of multiple properties in the same declaration statement > is inconsistent. > > > > public int $bar, string $qux; // this works > > > > public int $bar, $qux; //this emits error: Untyped property > A::$qux must not be mixed with typed properties > > > > It's better to allow type only before first property in the list and > apply them to all of them (like C, Java and others). > > Is this just an implementation issue? > > I'm actually glad this is prevented because it's confusing. Is `$qux` > typed or untyped? > I think its very obviously typed int. This would allow you to list a bunch of things of the same type in a single declaration, meaning only a single visibility and type for the line, instead of having to repeat the type for each property (whilst not having to repeat the visibility, this feels inconsistent). public string $firstName, $middleInitial, $lastName, $nickName; vs public string $firstName, string $middleInitial, string $lastName, string $nickName; I like the first much better personally. The second feels inconsistent, why would the visibility carry to all properties but not the type? > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >