Re: [PHP-DEV] Typed array properties V2

2020-01-19 Thread Mike Schinkel
> On Jan 19, 2020, at 8:42 PM, John Bafford wrote: > As a thought, perhaps the syntax '[Type]' for an array of Type. That way, you > could write ?[int], or [?int], or even ?[?int] and there would be no > ambiguity, and no need for parentheses since the array brackets would serve > that purpose.

Re: [PHP-DEV] Typed array properties V2

2020-01-19 Thread John Bafford
> On Jan 19, 2020, at 19:53, Mike Schinkel wrote: > > P.S. There was also the mention by Levi Morrison that the type[] syntax was > a poor one because of ambiguity between (?int)[] or ?(int[]). I would argue > that the latter would likely occur orders of magnitude more often than the > fo

Re: [PHP-DEV] Typed array properties V2

2020-01-19 Thread Mike Schinkel
Hi Nikita, > On Jan 18, 2020, at 5:05 AM, Nikita Popov wrote: > Did you read through the previous discussions on this topic? > https://externals.io/message/100946 in particular comes to mind. Thanks for this link. It was very insightful. > The primary concern about the previous typed array prop

Re: [PHP-DEV] Warn when declaring required parameter after optional one

2020-01-19 Thread Theodore Brown
On Fri, Jan 17, 2020 at 11:59 AM Nikita Popov wrote: >> I've created https://github.com/php/php-src/pull/5067 to make code like >>function test($foo = null, $bar) {} >> throw a warning > > I was interested in seeing how prevalent this pattern, is, so I ran > some analysis on the top 2k compos

[PHP-DEV] Re: Warn when declaring required parameter after optional one

2020-01-19 Thread Andrea Faulds
Hi Nikita, Nikita Popov wrote: Since nullable types have been available since PHP 7.1, having a required parameter after an optional one is increasingly likely a bug rather than an intentional workaround, so I think it would be good to throw a warning for this case. Wouldn't it be trivial to s