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.
40 lines
858 B
40 lines
858 B
<?php
|
|
|
|
function propertyCacheReceiver(object $object): object
|
|
{
|
|
return $object;
|
|
}
|
|
|
|
function propertyCacheSites(object $object, string $name, mixed $value): mixed
|
|
{
|
|
$first = $object->named;
|
|
$object->named = $value;
|
|
propertyCacheReceiver($object)->other = $value;
|
|
|
|
$dynamic = $object->{$name};
|
|
$object->{$name} = $value;
|
|
return [$first, $dynamic];
|
|
}
|
|
|
|
final class DirectMagicPropertySites
|
|
{
|
|
private array $values = [];
|
|
|
|
public function __get(string $name): mixed
|
|
{
|
|
return $this->values[$name] ?? null;
|
|
}
|
|
|
|
public function __set(string $name, mixed $value): void
|
|
{
|
|
$this->values[$name] = $value;
|
|
}
|
|
}
|
|
|
|
function directMagicPropertySites(mixed $value): mixed
|
|
{
|
|
$object = new DirectMagicPropertySites();
|
|
$current = $object->missing;
|
|
$object->missing = $value;
|
|
return $current;
|
|
}
|
|
|