Hi Joe, Just my €0.02
Joe Watkins wrote on 31/03/2016 09:34:
public $bar, int $foo; What does this mean? If it's not an error, what does this mean ?
To me, that should be an error; why would you want to group typed and untyped properties on one line?
public $bar, int $foo, $qux; If it's an error, why is it an error ?
Again, an error, because you are grouping the properties but giving them different types. It's an error for the same reason that "public $foo, private $bar" is an error - the keywords should all come before the list of names, not in the middle of it.
Both of these examples are just as ambiguous as public int $foo, $bar, $qux;
To me, this is completely unambiguous - you have three properties, you've grouped them together, so they're all the same. It reads naturally to me as "three properties, with public visibility and int type, called $foo, $bar, and $qux".
Access modifiers are assumed to apply to all declarations in a group, because that's what grouping is actually for. We don't need to make grouping about types, we need to make type declarations unambiguous.
It's not "making grouping about types", it's applying the same rules for grouping types as we apply for grouping visibilities.
Regards, -- Rowan Collins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php