This document describes how Go! AOP Framework handles PHP 8.5 features in proxy generation and interception, and what limitations exist. It is based on an audit of the framework on PHP 8.5.10 and PHP 8.6.0beta2 (see PR #597).
Several of the limitations below are actively being worked on — they are phrased as "tracked in #NNN" rather than permanent facts, and may already be fixed on master.
The pipe operator works inside woven method bodies.
Method bodies are moved verbatim into the <Class>OriginalTrait body trait, so any PHP 8.5 expression syntax
inside them is preserved.
clone with expressions in woven code work as expected.
The #[\NoDiscard] attribute is
copied to the generated proxy method, and the join-point dispatch returns the intercepted
method's value, so the engine-level "return value not used" warning keeps firing correctly for
woven methods.
Attributes on constants — including
#[\Deprecated] — are preserved: class constants stay in the woven trait together with their
attributes.
Closures in constant expressions used as parameter default values survive weaving in proxy method signatures.
static properties with asymmetric visibility (public static private(set)) work on classes that are woven; they
are never targeted by access(...) pointcuts (see the static-property note below).
On PHP 8.5, ReflectionNamedType::getName() resolves self/parent return types to concrete
class names. The proxy generators compensate by reading the raw AST type node where available,
so self/parent keywords are preserved in generated proxies.
A new expression in a constant expression (the default value of a parameter or of a promoted constructor
parameter, a static variable initializer, an attribute argument) is evaluated by the engine. The weaver leaves these
expressions as they are, so the code works, but an initialization(...) advice does not run for the objects they
create. Only new expressions in executable code are intercepted.
Static properties — including PHP 8.5 static properties with asymmetric visibility — cannot be
intercepted via access(...) pointcuts. PHP property hooks do not exist for static properties,
so the framework has no interception mechanism for them; AdviceMatcher excludes static
properties from property join points. This is a PHP engine constraint, not a bug.
| PHP 8.5 Feature | Interception / Weaving Support | Notes |
|---|---|---|
Pipe operator |> in method bodies |
✅ Works | Bodies are moved verbatim into the woven trait |
clone with |
✅ Works | |
#[\NoDiscard] |
✅ Propagated | Copied to proxy; join-point dispatch returns the value |
Attributes on class constants (incl. #[\Deprecated]) |
✅ Preserved | Constants stay in the woven trait |
| Closures / FCC as parameter defaults | ✅ Works | |
| Static asymmetric visibility (non-intercepted) | ✅ Preserved | Static properties are never interceptable via access() |
self/parent reflection resolution |
✅ Handled | Raw AST type nodes used in proxy generation |
new in initializers |
❌ Not intercepted | Evaluated by the engine, initialization(...) advices do not run for it |
Static property interception via access() |
❌ Never | No property hooks for static properties (PHP engine constraint) |