mirror of
https://github.com/php/php-src.git
synced 2026-04-27 01:48:26 +02:00
f6a0bb4d04
RFC: https://wiki.php.net/rfc/closures_in_const_expr Co-authored-by: Volker Dusch <volker@tideways-gmbh.com> Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com> Co-authored-by: Arthur Kurbidaev <artkurbidaev@gmail.com>
18 lines
270 B
PHP
18 lines
270 B
PHP
--TEST--
|
|
Disallows using variables.
|
|
--FILE--
|
|
<?php
|
|
|
|
$foo = "bar";
|
|
|
|
const Closure = static function () use ($foo) {
|
|
echo $foo, PHP_EOL;
|
|
};
|
|
|
|
var_dump(Closure);
|
|
(Closure)();
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Fatal error: Cannot use(...) variables in constant expression in %s on line %d
|