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.
39 lines
666 B
39 lines
666 B
--TEST--
|
|
use const for importing namespace constants
|
|
--FILE--
|
|
<?php
|
|
namespace Lib\Config {
|
|
const HOST = "localhost";
|
|
const PORT = 8080;
|
|
const DEBUG = true;
|
|
}
|
|
|
|
namespace App {
|
|
use const Lib\Config\HOST;
|
|
use const Lib\Config\PORT;
|
|
use const Lib\Config\DEBUG;
|
|
|
|
function getServer(): string {
|
|
return HOST . ":" . PORT;
|
|
}
|
|
|
|
function isDebug(): bool {
|
|
return DEBUG;
|
|
}
|
|
}
|
|
|
|
namespace {
|
|
use function App\getServer;
|
|
use function App\isDebug;
|
|
|
|
function main() {
|
|
var_dump(getServer());
|
|
var_dump(isDebug());
|
|
echo "done\n";
|
|
}
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
string(14) "localhost:8080"
|
|
bool(true)
|
|
done
|
|
|