1
0
mirror of https://github.com/php/php-src.git synced 2026-03-29 03:32:20 +02:00
Files
archived-php-src/Zend/tests/gh11488.phpt
Ilija Tovilo 68ef3938f4 Fix missing "Optional parameter before required" deprecation on union null type
The check would only work for the ?type syntax, but not  type|null. Switch to a
check during type compilation instead.

Fixes GH-11488
Closes GH-11497
2023-06-28 20:45:43 +02:00

22 lines
544 B
PHP

--TEST--
GH-11488: "Optional parameter before required" warning for union nullable type
--FILE--
<?php
function a(
string|null $a = null,
$b,
) {}
function b(
Foo&Bar $c = null,
$d,
) {}
function c(
(Foo&Bar)|null $e = null,
$f,
) {}
?>
--EXPECTF--
Deprecated: Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in %s on line %d
Deprecated: Optional parameter $e declared before required parameter $f is implicitly treated as a required parameter in %s on line %d