Support compilation of static information in proxy classes
We use the ReflectionService during runtime to get information about interface implementations, method parameters or other reflection data that will never change after compilation. If we can manage to store that information inside the classes that need that specific information we can save the initialization of the ReflectionService and cache accesses for some invocations.
CompileStatic should be used to mark static methods inside proxyable classes as compilable. The object manager is passed to the method as the only context beside the current class (which can be accessed with
get_called_class with late static bind) and allows access to the ReflectionService. During compilation the proxy builder will call these methods and override the method with the computed return value in the generated proxy class.
Besides reflection data anything that doesn't change after the compile run can be pre-computed with this approach.