Re: Warn when declaring required parameter after optional one

From: Date: Wed, 05 Feb 2020 12:15:56 +0000
Subject: Re: Warn when declaring required parameter after optional one
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-108405@lists.php.net to get a copy of this message
Hi, On Wednesday, February 5, 2020, Nikita Popov <nikita.ppv@gmail.com> wrote: > > > I like this idea and have updated the pull request to ignore the "Type > $param = null" case, so the deprecation should now just catch the > "definitely" incorrect signatures. > > So to summarize the current state: > > function test($foo = "bar", $baz) {} > // Deprecated: Required parameter $baz follows optional parameter $foo > > function test(Abc $foo = null, $baz) {} > // No warnings, works fine! > > With that adjustment made, are there any further concerns about this > change? Can you please just clarify which of the following will emit a deprecation? function f1($a = null, $b) {} function f2(A $a = null, $b) {} function f3(?A $a = null, $b) {} (I think f1 will, f2 won't, but f3?) Thanks > > Regards, > Nikita > -- Guilliam Xavier

« previous php.internals (#108405) next »