mirror of
https://github.com/php/php-src.git
synced 2026-04-27 01:48:26 +02:00
2042fd34e0
RFC: https://wiki.php.net/rfc/fcc_in_const_expr Co-authored-by: Volker Dusch <volker@tideways-gmbh.com>
29 lines
463 B
PHP
29 lines
463 B
PHP
--TEST--
|
|
Allow defining FCC for userland functions in const expressions.
|
|
--FILE--
|
|
<?php
|
|
|
|
function my_function(string $foo) {
|
|
echo "Called ", __FUNCTION__, PHP_EOL;
|
|
var_dump($foo);
|
|
}
|
|
|
|
const Closure = my_function(...);
|
|
|
|
var_dump(Closure);
|
|
(Closure)("abc");
|
|
|
|
?>
|
|
--EXPECTF--
|
|
object(Closure)#%d (2) {
|
|
["function"]=>
|
|
string(11) "my_function"
|
|
["parameter"]=>
|
|
array(1) {
|
|
["$foo"]=>
|
|
string(10) "<required>"
|
|
}
|
|
}
|
|
Called my_function
|
|
string(3) "abc"
|