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.
29 lines
617 B
29 lines
617 B
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace {
|
|
// lib mode owns an embedded module but must not execute the bin entrypoint.
|
|
// This declaration must also be omitted from the published import stub.
|
|
function main(): void
|
|
{
|
|
throw new RuntimeException('lib mode invoked bin main()');
|
|
}
|
|
}
|
|
|
|
namespace TypePhpIntegration\Library {
|
|
function add(int $left, int $right): int
|
|
{
|
|
return $left + $right;
|
|
}
|
|
|
|
final class Counter
|
|
{
|
|
public int $value = 0;
|
|
|
|
public function add(int $delta): int
|
|
{
|
|
return $this->value += $delta;
|
|
}
|
|
}
|
|
}
|
|
|