Open Hanmac opened 2 years ago
I'm afraid it seems to be impossible with Reflection - we would need to rewrite it to use AST instead. May you can try to use AccessorOrder annotation?
AccessorOrder means i would need to use custom and to define the whole order again
if i had a way to define a relative order (-1 vs +1) i think it would be way cleaner
I'm having the same issue, any news on this?
Steps required to reproduce the problem
use annotations on properties, and have some of them be inserted via traits:
Expected Result
i Expected the result that
$t
is serialized between$a
and$b
Actual Result
But instead
$t
is serialized after$b
.i assume it has something to do with the order of the properties like:
(new ReflectionClass(C::class))->getProperties()
I assume that PHP can't detect at which position the
use
is called.for a Possible Solution, a better way of ordering the Properties would be nice, like to give
$a
the@Order(-1)
and$b
the@Order( +1)
. So when it would try to order after this new annotation, it would order them$a, $t, $b
as i want.The Reason
I have multiple classes that uses the same (block of) attributes over and over again, but because the xml needs to follow a specific sequence of elements, they need to be in a specific order.