mirror of
https://github.com/php/php-src.git
synced 2026-03-29 03:32:20 +02:00
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
22 lines
544 B
PHP
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
|