Kaan
How do I cleanly implement "withX" copy methods on readonly value objects?
A readonly withX returns a new instance: `new self` with named arguments is portable, and `clone($this, [...])` fits PHP 8.5 when validation is simple.
Tag
Object-oriented design: interfaces, dependency injection, value objects and boundaries, covered in posts, notes and practical examples. questions under this tag, answered directly.
1 answered questions carry this tag.
A readonly withX returns a new instance: `new self` with named arguments is portable, and `clone($this, [...])` fits PHP 8.5 when validation is simple.