On Thu, Jan 21, 2021, at 4:37 PM, Sara Golemon wrote:
> On Thu, Jan 21, 2021 at 3:29 PM Larry Garfield
> wrote:
> >
> > I'm unclear why you'd allow null at all then.
> > If you want $bar to be optional, and to be an empty array if not
> specified, then just do:
> >
> > function foo(array $bar = [
On Thu, Jan 21, 2021 at 3:29 PM Larry Garfield
wrote:
>
> I'm unclear why you'd allow null at all then.
> If you want $bar to be optional, and to be an empty array if not
specified, then just do:
>
> function foo(array $bar = []) { ... }
>
> At that point, the only thing adding ?array does is all
On 21/01/2021 21:28, Larry Garfield wrote:
I'm unclear why you'd allow null at all then. If you want $bar to be optional,
and to be an empty array if not specified, then just do:
function foo(array $bar = []) { ... }
At that point, the only thing adding ?array does is allow you to explicitly
On Thu, Jan 21, 2021, at 5:51 AM, Daniel Simkus wrote:
> Hello all,
>
> I am writing to see if anyone is interested in an RFC for ability to
> automatically coalesce nullable method parameters with the supplied
> default. It would look something like this:
>
> function foo(?array $bar ??= []) {
Hello all,
I am writing to see if anyone is interested in an RFC for ability to
automatically coalesce nullable method parameters with the supplied default. It
would look something like this:
function foo(?array $bar ??= []) {
This would result in $bar automatically converting to an array if n