mirror of
https://github.com/php/php-src.git
synced 2026-04-20 14:31:06 +02:00
The exception for null default values here exists to keep compatibility with PHP < 7.1 where "Foo $bar = null" was the canonical way to create a nullable parameter. If the parameter is actually "?Foo $bar = null", then clearly compatibility with PHP < 7.1 is not a concern, and we can throw a deprecation notice.
19 lines
858 B
PHP
19 lines
858 B
PHP
--TEST--
|
|
Required parameter after optional is deprecated
|
|
--FILE--
|
|
<?php
|
|
|
|
function test($testA = null, $testB = null, $testC) {}
|
|
function test2(Type $test2A = null, $test2B = null, $test2C) {}
|
|
function test3(Type $test3A = null, ?Type2 $test3B = null, $test3C) {}
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Deprecated: Optional parameter $testA declared before required parameter $testC is implicitly treated as a required parameter in %s on line %d
|
|
|
|
Deprecated: Optional parameter $testB declared before required parameter $testC is implicitly treated as a required parameter in %s on line %d
|
|
|
|
Deprecated: Optional parameter $test2B declared before required parameter $test2C is implicitly treated as a required parameter in %s on line %d
|
|
|
|
Deprecated: Optional parameter $test3B declared before required parameter $test3C is implicitly treated as a required parameter in %s on line %d
|