Damien Seguy
banner
dseguy.bsky.social
Damien Seguy
@dseguy.bsky.social
Code quality fanatic, static analysis expert @exakat, elephpant breeder, husband, father, speaker!
I have it, let me go home first and we sort out the next leg of the journey
October 29, 2025 at 5:23 PM
Ok, seen how many?
October 29, 2025 at 3:21 PM
Indeed, clone happens AFTER the ->, so the code is cloning the result of the setter, which happens to be the original object itself.

A case of left associativity.

clone $object->property clones the property, not the object.
(clone $object)->property

Same for new

3v4l.org/UHrBS
UHrBS - created on 3v4l.org
View the output of this script on 3v4l.org: the online PHP shell with 250+ PHP versions
3v4l.org
October 7, 2025 at 5:26 AM
Also, yes, some precedences are missing in that table. new and clone, for example.
October 6, 2025 at 5:34 PM
Paint me intrigued : what does that code looked like?

(clone $a)->b;
where property b changed between $a and the clone? That is possible.
October 6, 2025 at 5:34 PM
The reason is here : peakd.com/hive-168588/...
On the use of enums | PeakD
When should you use PHP enums, and when shouldn't you?... by crell
peakd.com
October 3, 2025 at 4:53 AM
Indeed it works. It is a variation of closure2 in the example.
September 20, 2025 at 9:23 AM