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
{{ message }}
Repository navigation
Partial reflection: reflect a class whose ancestors are not available instead of throwing #251
To reflect a class, the engine has to locate every ancestor: parent class, interfaces and traits. It reflects an ancestor natively only when it is already declared; otherwise it asks the locator. When the locator can't find it, reflection throws:
InvalidArgumentException: Class GeneratedCode\Admin\BaseReportController was not found by locator
The ancestor may be generated at runtime and loaded by another autoloader, declared by class_alias(), or defined outside the Composer autoloader. The whole class then can't be reflected, even for questions that don't need the missing ancestor: its own methods, properties, attributes, or whether its name matches a pattern.
For goaop/framework this means a class below the include paths fails to weave. It fails even when the pointcut can't match any of its methods, because matching walks every method, including inherited ones (found while working on goaop/goaop-symfony-bundle#17).
Feature: partial reflection
When an ancestor can't be located, return a partial reflection instead of throwing:
What comes from the class's own source stays available: name, modifiers, own methods, properties, constants and attributes, and the names of the parent, interfaces and traits as written.
Information that needs the missing ancestor (inherited members, getParentClass(), isSubclassOf(), prototypes) is either omitted or reported explicitly.
The reflection says it is partial, e.g. isPartial(): bool plus the list of missing class names, so the caller decides what to do.
The application chooses the policy:
strict (default, current behaviour): throw as today;
partial: return partial reflection. A consumer such as goaop/framework can then weave with what is known (for example the class's own methods), skip the class with a clear message, or stop.
A switch on ReflectionEngine::init() or the locator would let existing users keep the current behaviour.
Partial reflection of classes whose ancestors can not be located #252 (4.1.0 / 5.1.0) added MissingAncestorPolicy::Strict (the default) and Partial, set through ReflectionEngine::init() or setMissingAncestorPolicy(). It also added ClassNotFoundException, isPartial() and getMissingClassNames().
Activity
Add partial reflection of classes whose ancestors can not be located
lisachenko commentedon Nov 5, 2026
Implemented and released in 4.2.0 / 5.2.0:
MissingAncestorPolicy::Strict(the default) andPartial, set throughReflectionEngine::init()orsetMissingAncestorPolicy(). It also addedClassNotFoundException,isPartial()andgetMissingClassNames().getParentClassName()returns them, and a partial reflection'sgetInterfaceNames()/implementsInterface()/getTraitNames()include them.goaop/framework uses this through the opt-in
Features::PARTIAL_REFLECTIONflag (goaop/framework#788).Generated by Claude Code