<?php class Point { public readonly string $name; public function __construct( public readonly int $x, public readonly int $y, ) {} public function setName(string $name): static { $this->name ??= $name; return $this; } } $p = new Point(3, 4); $p->setName('Larry'); var_dump($p); $p2 = new class extends Point { public function __construct() { $this->x = 3; $this->y = 4; $this->name = 'Larry'; } }; var_dump($p2);
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`