Bug #68445 [Opn]: Optional arguments may precede required arguments in function declarations
| From: | nikic@php.net | Date: | Thu, 25 Jun 2020 08:12:37 +0000 |
| Subject: | Bug #68445 [Opn]: Optional arguments may precede required arguments in function declarations | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-227643@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68445&edit=1
ID: 68445
Updated by: nikic@php.net
Reported by: ajf at ajf dot me
Summary: Optional arguments may precede required arguments in
function declarations
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: OS X Yosemite
PHP Version: 5.6.3
Block user comment: N
Private report: N
New Comment:
This has been deprecated in PHP 8, with the exception of "Type $x = null" style
parameters.
Previous Comments:
------------------------------------------------------------------------
[2017-03-27 20:53:42] tpunt@php.net
Related To: Bug #53399
------------------------------------------------------------------------
[2017-03-16 18:05:05] nikic@php.net
Related To: Bug #74251
------------------------------------------------------------------------
[2017-01-08 15:37:44] ajf@php.net
We could perhaps deprecate it, but I doubt there's much advantage to doing so. It would hit a
lot of existing code for what is really mostly a cosmetic difference.
Besides, PHP doesn't need to warn of this specific issue, code sniffers and IDEs can do that if
they want.
------------------------------------------------------------------------
[2016-07-15 20:07:56] nikic@php.net
@dmitry: In general I agree, but I don't think we can change this for PHP 7.1. I think many
people use this hack to get nullable argument types in PHP < 7.1. They won't be able to use
real nullable types unless they require PHP 7.1, which is not realistic.
------------------------------------------------------------------------
[2016-07-14 11:08:26] dmitry@php.net
I think, declaration of arguments without default values after the ones with default values - should
be prohibited by compiler (at least since PHP-7.1)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=68445
--
Edit this bug report at https://bugs.php.net/bug.php?id=68445&edit=1