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.
19 lines
381 B
19 lines
381 B
--TEST--
|
|
Symfony DI pattern: indent generated code lines with explode array_map implode
|
|
--FILE--
|
|
<?php
|
|
|
|
function indentCode(string $code): string
|
|
{
|
|
return implode("\n", array_map(static fn ($line) => $line ? ' '.$line : $line, explode("\n", $code)));
|
|
}
|
|
|
|
function main(): void
|
|
{
|
|
var_dump(indentCode("first\n\nsecond"));
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
string(21) " first
|
|
|
|
second"
|
|
|