Repository navigation
feat(core)!: enable function and initialization interception from registered pointcuts - #767
Merged
Merged
Conversation
…istered pointcuts Features::INTERCEPT_FUNCTIONS and Features::INTERCEPT_INITIALIZATIONS made users switch on machinery that the registered pointcuts already describe. Both are removed: - execution(Namespace\function(*)) pointcuts weave function proxies without a flag; AdviceMatcher already skips every advisor without a KIND_FUNCTION pointcut. - ConstructorExecutionTransformer is always registered and turns itself on only while an advisor with a KIND_INIT pointcut is registered. The new internal AdvisorIndex loads the aspects that are not loaded yet (lazy aspects included) and collects the pointcut kinds again after every registration in the container. Before, an initialization(...) pointcut without the flag wove __initialization() but never ran its advice. Passing one of the removed bits now fails with a hint to drop it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hhj7Aqnac5xDA6L31WeJs8
…nly API expectExceptionMessageIsOrContains() is missing on the lowest supported PHPUnit, and expectExceptionMessage() is deprecated on the newest one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hhj7Aqnac5xDA6L31WeJs8
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #767 +/- ##
=========================================
Coverage 97.81% 97.82%
- Complexity 1841 1847 +6
=========================================
Files 104 105 +1
Lines 4849 4867 +18
=========================================
+ Hits 4743 4761 +18
Misses 106 106 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
AdvisorIndex now loads the aspects before the weaver runs in the default pipeline, so the weaver's own loading path (kept for kernels that override the transformer services) lost its indirect coverage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hhj7Aqnac5xDA6L31WeJs8
lisachenko
commented
Oct 15, 2026
lisachenko
commented
Oct 15, 2026
lisachenko
commented
Oct 15, 2026
Feature bit values are internal: bits 1 and 2 are rejected by the generic unknown-feature validation like any other undefined bit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hhj7Aqnac5xDA6L31WeJs8
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hhj7Aqnac5xDA6L31WeJs8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Users no longer set
Features::INTERCEPT_FUNCTIONSorFeatures::INTERCEPT_INITIALIZATIONS. The framework now works out from the registered pointcuts what it has to enable, and both flags are removed (BC break, same treatment asPARAMETER_WIDENING).AdviceMatcher::getAdvicesForFunctions(). That method already skips every advisor without aKIND_FUNCTIONpointcut, so anexecution(Namespace\function(*))pointcut now weaves without a flag, and with no such pointcut it still costs nothing.ConstructorExecutionTransformeris now always registered. ItsgetSourceMarkers()returns[](rule off) unless an advisor with aKIND_INITpointcut is registered.SyntaxTreeRewriteralready drops a prefiltered rule that has no matching marker, so a file needing no rule is still never walked.PrefilteredNodeRewriterdocuments that an empty list turns a rule off.Go\Core\AdvisorIndexloads the aspects that are not loaded yet on the first query, the same wayWeavingTransformerdoes on a cache miss. It keeps the union of the advisors' pointcut kinds and collects it again whenever the container's cachedgetServicesByInterface(Advisor::class)array changes, which happens after any registration. An aspect registered or loaded later is therefore picked up. Warm-cache requests never build any of this.featuresfails with anInvalidConfigurationExceptionthat tells the user to drop the flag.INTERCEPT_INCLUDES(legacy include routing, not driven by pointcuts) andPREBUILT_CACHEare unchanged.Behaviour change worth noting: an
initialization(...)pointcut without the flag used to weave__initialization()but never run its advice. The fixture project'sInitializationAspectwas in exactly that state. It now interceptsnew, and a new functional test checks this. With the gate deliberately broken, that test fails.Transformation performance (
composer test:performance:transformation, base and head alternated 3×, JIT disabled), average ratios:Checklist
type(scope): summary)AdvisorIndexTest, rule on/off cases inConstructorExecutionTransformerTest, removed-flag cases inAspectKernelTest, functionalClassWeavingTest::testInitializationAdviceRunsOnNewInWovenCode)composer checkpasses (cs, phpstan level 10, 3116 tests)🤖 Generated with Claude Code
https://claude.ai/code/session_01Hhj7Aqnac5xDA6L31WeJs8
Generated by Claude Code