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.
25 lines
427 B
25 lines
427 B
--TEST--
|
|
Symfony pattern: count() dispatches to Countable object
|
|
--FILE--
|
|
<?php
|
|
|
|
final class CountableRoutes implements Countable
|
|
{
|
|
public function __construct(private array $routes)
|
|
{
|
|
}
|
|
|
|
public function count(): int
|
|
{
|
|
return count($this->routes);
|
|
}
|
|
}
|
|
|
|
function main(): void
|
|
{
|
|
$routes = new CountableRoutes(['home', 'about', 'contact']);
|
|
var_dump(count($routes));
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
int(3)
|
|
|