<?php readonly class Foobar { public function __construct(public string $foo) {} } try { $reflection = new ReflectionClass(Foobar::class); $obj = $reflection->newInstanceWithoutConstructor(); echo $obj->foo, PHP_EOL; } catch (Throwable $exception) { echo $exception->getMessage(), PHP_EOL, $exception::class, PHP_EOL, implode(PHP_EOL, class_parents($exception)); }
You have javascript disabled. You will not be able to edit any code.