- Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
- Output for 8.1.0 - 8.1.33
- Parse error: syntax error, unexpected token "readonly", expecting "abstract" or "final" or "class" in /in/dSpQO on line 3
Process exited with code 255.
<?php
final readonly class ObjectCollector
{
private SplObjectStorage $storage;
public function __construct()
{
$this->storage = new SplObjectStorage();
}
public function add(object $object): void
{
$this->storage->attach($object);
}
}
(new ObjectCollector())->add(new stdClass());