This fixes a problem when using old and new reflection libraries in conjunction. This is due to the fact that both use xp::$meta for caching reasons, but fill it differently.
<?php
use web\frontend\Handler;
#[Handler]
class Users {
}
Before
Using the lang.XPClass annotation API will infer with the results returned by lang.reflection.Type:
# Return value as expected:
$ xp -w 'return [...\lang\Reflection::type("Users")->annotations()]'
[web.frontend.Handler => lang.reflection.Annotation<web.frontend.Handler([])>]
# The annotation name is only returned in lowercase!
$ xp -w '\lang\XPClass::forName("Users")->getAnnotations();
return [...\lang\Reflection::type("Users")->annotations()]'
[handler => lang.reflection.Annotation<handler([])>]
After
The lang.XPClass annotation API now also records the original annotation names, and lang.reflection.Type now returns the expected annotation:
$ xp -w '\lang\XPClass::forName("Users")->getAnnotations();
return [...\lang\Reflection::type("Users")->annotations()]'
[web.frontend.Handler => lang.reflection.Annotation<web.frontend.Handler([])>]
This fixes a problem when using old and new reflection libraries in conjunction. This is due to the fact that both use
xp::$meta
for caching reasons, but fill it differently.Before
Using the
lang.XPClass
annotation API will infer with the results returned bylang.reflection.Type
:After
The
lang.XPClass
annotation API now also records the original annotation names, andlang.reflection.Type
now returns the expected annotation: