You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use annotations on properties, and have some of them be inserted via traits:
trait T { protected$t; }
class C {
protected$a;
use T;
protected$b;
}
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.
The text was updated successfully, but these errors were encountered:
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?
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.
The text was updated successfully, but these errors were encountered: