readOnly = $state; return $this; } public function isReadOnly(): bool { return $this->readOnly; } /** @throws Nette\InvalidStateException */ public function validate(): void { if ($this->readOnly && !$this->getType()) { throw new Nette\InvalidStateException("Property \${$this->getName()}: Read-only properties are only supported on typed property."); } } }