[php-src] Issue #13752: PHP 8.4 | Implicitly nullable deprecation ignores null in constant expressions in default value

From: Date: Mon, 18 Mar 2024 22:25:42 +0000
Subject: [php-src] Issue #13752: PHP 8.4 | Implicitly nullable deprecation ignores null in constant expressions in default value
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246609@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/13752 Author: jrfnl ### Description The following code: ```php <?php define('MY_CONST', false); function constantExpressionInDefault( int $a = MY_CONST ? 10 : NULL) {} ``` Resulted in this output: ``` ``` But I expected this output instead: ``` Deprecated: Implicitly marking parameter $paramA as nullable is deprecated, the explicit nullable type must be used instead in ... on line 3 ``` Demo: * https://3v4l.org/26TbS/rfc#vgit.master * https://3v4l.org/26TbS#veol ### Context I was doing some experimenting with the new deprecation as introduced in #12959 for the [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility) sniff to detect this via static analysis. Not sure if this behaviour is intentional or a bug, but I figured I should flag it, so you all could have a look at it and take a decision on what should be done with parameters declared like the above example. /xx @kocsismate @Girgias ### PHP Version master ### Operating System N/A

« previous php.bugs (#246609) next »