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.
 
 

44 lines
815 B

--TEST--
TypePHP supports explicit-visibility final promoted properties with PHP 8.4 libphp
--FILE--
<?php
class FinalPromotedProperty
{
public function __construct(
public final string $value,
) {
}
}
#[Native]
class NativeFinalPromotedProperty
{
public function __construct(
public final int $value,
) {
}
}
function main(): void
{
$object = new FinalPromotedProperty('promoted');
var_dump($object->value);
$property = new ReflectionProperty(FinalPromotedProperty::class, 'value');
var_dump(
$property->isPublic(),
$property->isPromoted(),
$property->isFinal(),
);
$native = new NativeFinalPromotedProperty(42);
var_dump($native->value);
}
?>
--EXPECT--
string(8) "promoted"
bool(true)
bool(true)
bool(true)
int(42)