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.
70 lines
1.1 KiB
70 lines
1.1 KiB
<?php
|
|
|
|
class KnownNewObjectCodegen
|
|
{
|
|
public int $value = 0;
|
|
}
|
|
|
|
class EmptyArrayDefaultCodegen
|
|
{
|
|
public array $values = [];
|
|
}
|
|
|
|
class RuntimeArrayDefaultCodegen
|
|
{
|
|
public int $scalar = 7;
|
|
public array $values = [1];
|
|
public array $labels = ['default'];
|
|
}
|
|
|
|
class ScalarExpressionDefaultCodegen
|
|
{
|
|
public int $integer = 20 + 3;
|
|
public string $string = 'type' . 'php';
|
|
}
|
|
|
|
class ScalarConstantDefaultCodegen
|
|
{
|
|
private const VALUE = 23;
|
|
|
|
public int $integer = self::VALUE;
|
|
}
|
|
|
|
enum EnumPropertyDefaultCaseCodegen
|
|
{
|
|
case First;
|
|
}
|
|
|
|
class EnumPropertyDefaultCodegen
|
|
{
|
|
public EnumPropertyDefaultCaseCodegen $value = EnumPropertyDefaultCaseCodegen::First;
|
|
}
|
|
|
|
class HookOnlyDefaultCodegen
|
|
{
|
|
public string $value {
|
|
get => $this->value;
|
|
set => $value;
|
|
}
|
|
}
|
|
|
|
class AsymmetricOnlyDefaultCodegen
|
|
{
|
|
public private(set) int $value = 0;
|
|
}
|
|
|
|
function createKnownObjects(int $count): void
|
|
{
|
|
for ($i = 0; $i < $count; ++$i) {
|
|
$object = new KnownNewObjectCodegen();
|
|
}
|
|
}
|
|
|
|
function createRuntimeObject(): object
|
|
{
|
|
return new RuntimeProvidedObjectCodegen();
|
|
}
|
|
|
|
function main(): void
|
|
{
|
|
}
|
|
|