Hey, > public function withStatus($code, $reasonPhrase = ''): Response > { > return clone $this { > $this->statusCode = $code; > > $this->reasonPhrase = $reasonPhrase; > } > };
How to refer to any of the properties of the current instance? Let's say this: ``` class Foo { protected int $code; protected string $message; public function withStatus($code, $message): Foo { return clone $this { $this->code = $code; // so far so good // Which $this->message is what? $this->message = "cloned: (" . $this->message . ")" . $message; } } } ``` > Thanks for your efforts and for bringing that up. > I am curious if possible to implement the feature without using `with` > keyword > it visually could look pretty close to something like an object initializer > in the future: > > return clone $this {c: 1}; > return new Bar {c: 1}; Similarity is not necessarily always good. Regards, Zoltán Fekete