TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
449 B
20 lines
449 B
--TEST--
|
|
Symfony pattern: static closure normalizer returns another static closure
|
|
--FILE--
|
|
<?php
|
|
|
|
function buildTranslator(string $domain): Closure
|
|
{
|
|
$normalizer = static fn (string $message): Closure => static fn () => '['.$domain.'] '.$message;
|
|
|
|
return $normalizer('upload failed');
|
|
}
|
|
|
|
function main(): void
|
|
{
|
|
$message = buildTranslator('validators');
|
|
var_dump($message());
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
string(26) "[validators] upload failed"
|
|
|