Re: [RFC] [Discussion] Clone with
| From: | Bob Magic | Date: | Tue, 18 Apr 2023 20:00:29 +0000 |
| Subject: | Re: [RFC] [Discussion] Clone with | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120069@lists.php.net to get a copy of this message | ||
> [1] In fact if the right hand side of with may be an expression that
> evaluates to an array, folks wouldn't need to learn new syntax at all:
>
> $newProperties = [ "foo" => "bar" ];
> clone $object with $newProperties;
>
> and
>
> clone $object with [ "foo" => "bar" ];
in my opinion this is sick, as in awesome. the {} version makes no sense to
me unless the language gains $var = {} ; to skip $var = (object)[];