Repository navigation
fix(demos): repair the AOP switch and split the demo into backend and frontend - #766
Merged
Merged
Conversation
… frontend With AOP switched off the page died halfway: resolving the source file of a showcase called MagicConstantTransformer::resolveFileName(), which needs the aspect kernel that is not booted in this mode. The fatal error cut the page before the Bootstrap bundle and the switch script, so neither the dropdown menus nor the switch reacted any more. The demo is now split: - index.php is a small front controller: it stores the switch state and runs the selected showcase - Demo\Showcase holds the showcases (catalog, runner, result, source code); only woven classes (Proxy) have their file name resolved to the original - templates/page.php is the HTML, assets/demo.css and assets/demo.js the styles and the behaviour of the page The AOP switch is a form posted to the server, which keeps the state in a cookie and redirects back, so it works without JavaScript. The navigation is a plain sidebar (a drawer on small screens) instead of Bootstrap dropdowns. The new design has light and dark themes, a landing page with a card per example, the output in a terminal panel, the usage code, the aspect and the class in source tabs highlighted with highlight.js, and copy buttons. The CI smoke test lists the showcases from the catalog and renders every page with AOP on and off, checking that it is rendered completely. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TkXmBX6yR2tyL4TqAzphcm
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #766 +/- ##
=========================================
Coverage 97.81% 97.81%
Complexity 1841 1841
=========================================
Files 104 104
Lines 4849 4849
=========================================
Hits 4743 4743
Misses 106 106 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Bug: with AOP switched off, the demo page crashed halfway through rendering. The source panels called
MagicConstantTransformer::resolveFileName(), which needs the aspect kernel, and the kernel isn't booted in that mode. The fatal error cut the page off before the Bootstrap bundle and the switch script were output, so the switch stuck on "Off" and none of the dropdown menu items could be clicked.Restructure: the backend and frontend are now in separate files:
demos/index.php(~45 lines): stores the switch state, runs the selected showcase, renders the templateDemo\Showcase\{Showcase, ShowcaseCatalog, ShowcaseResult, SourceCode}: the catalog of examples, each with its scenario closure. Only woven classes (Proxy) have their file name resolved back from the cachedemos/templates/page.php: plain HTML, only escaping and loopsdemos/assets/demo.css,demos/assets/demo.jsDemo\Highlighteris removed; highlighting is done in the browser with highlight.js.UI:
CI: the demo smoke test used to
grepcase '…'lines out ofindex.php. It now lists the showcases from the catalog and renders every page with AOP on and off. It also checks that each page is rendered all the way to</html>, which catches the original bug: the old code fails this check.Checklist
type(scope): summary)composer checkpasses (php-cs-fixer clean, phpstan level 10 clean, phpunit 3104 tests OK)🤖 Generated with Claude Code
https://claude.ai/code/session_01TkXmBX6yR2tyL4TqAzphcm
Generated by Claude Code