It could be nice to have Fluent\Query and Fluent\QueryImmutable that is always returning clone of this. First tests show that it is about 2x slower (0.0000069836s vs 0.0000030076) - so still really quick.
Prepare this on PHP 8.1 - on Query we can have typed properties for simple scalar types. Complex types can be in array as it is now and on the clone, we can iterate this array deep and clone every object we found.
I'm thinking, regular Fluent\Query can have some $this->this() function with return $this and on Fluent\QueryInterface it will be overwritten to something like return clone $this.
It could be nice to have
Fluent\Query
andFluent\QueryImmutable
that is always returning clone of this. First tests show that it is about 2x slower (0.0000069836s
vs0.0000030076
) - so still really quick.Prepare this on PHP 8.1 - on
Query
we can have typed properties for simple scalar types. Complex types can be inarray
as it is now and on the clone, we can iterate this array deep and clone every object we found.I'm thinking, regular
Fluent\Query
can have some$this->this()
function withreturn $this
and onFluent\QueryInterface
it will be overwritten to something likereturn clone $this
.