[php-src] Issue #8024: No deprecation warning is triggered for nullable optional parameters before required ones
| From: | m-vo | Date: | Thu, 03 Feb 2022 12:39:11 +0000 |
| Subject: | [php-src] Issue #8024: No deprecation warning is triggered for nullable optional parameters before required ones | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239432@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8024
Author: m-vo
### Description
The following code:
```php
<?php
function foo(int $param_optional = null, int $param_required) {}
```
Resulted in this output:
```
(no deprecation warning triggered)
```
But I expected this output instead:
```
Deprecated: Optional parameter $param_optional declared before required parameter $param_required is
implicitly treated as a required parameter in […]```
```
It seems having a nullable parameter will prevent the deprecation from being triggered. See https://3v4l.org/biVG1#v8.1.2 for a comparison.
### PHP Version
>=PHP8.0
### Operating System
_No response_