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.
41 lines
662 B
41 lines
662 B
--TEST--
|
|
object link operator
|
|
--FILE--
|
|
<?php
|
|
class StackHolder
|
|
{
|
|
public static array $stack = [];
|
|
|
|
public static function push(string $item): void
|
|
{
|
|
self::$stack[] = $item;
|
|
}
|
|
|
|
public static function pop(): void
|
|
{
|
|
array_pop(self::$stack);
|
|
}
|
|
|
|
public static function count(): int
|
|
{
|
|
return count(self::$stack);
|
|
}
|
|
}
|
|
|
|
function main(): int
|
|
{
|
|
StackHolder::push('a');
|
|
StackHolder::push('b');
|
|
StackHolder::pop();
|
|
|
|
if (StackHolder::count() !== 1) {
|
|
echo "FAIL: expected 1, got " . StackHolder::count() . "\n";
|
|
return 1;
|
|
}
|
|
|
|
echo "OK\n";
|
|
return 0;
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
OK
|
|
|