php-src/Zend/tests/required_param_after_optional.phpt
Nikita Popov 3b08f53c97 Deprecate required param after optional
As an exception, we allow "Type $foo = null" to occur before a
required parameter, because this pattern was used as a replacement
for nullable types in PHP versions older than 7.1.

Closes GH-5067.
2020-02-18 14:35:58 +01:00

15 lines
459 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: Required parameter $testC follows optional parameter $testA in %s on line %d
Deprecated: Required parameter $test2C follows optional parameter $test2B in %s on line %d