Add support for Symfony UX Twig Component and Live Component attributes#329
Merged
Add support for Symfony UX Twig Component and Live Component attributes#329
Conversation
Closes #328 Detect usages from symfony/ux-twig-component and symfony/ux-live-component: Properties: - #[LiveProp] — mark as READ + WRITE (hydrated/dehydrated by framework) - #[ExposeInTemplate] — mark as READ Methods: - Constructor and mount() on #[AsTwigComponent]/#[AsLiveComponent] classes - #[PreMount], #[PostMount] lifecycle hooks - #[ExposeInTemplate] on methods - #[LiveAction] (also covers #[LiveListener] via IS_INSTANCEOF) - #[PostHydrate], #[PreDehydrate], #[PreReRender] lifecycle hooks Method references from attribute arguments: - #[LiveProp(hydrateWith/dehydrateWith/onUpdated/modifier/fieldName)] - #[ExposeInTemplate(getter)] - #[AsLiveComponent(defaultAction)] Co-Authored-By: Claude Code
Co-Authored-By: Claude Code
Co-Authored-By: Claude Code
92645b0 to
30eb2c6
Compare
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.
Summary
Closes #328
Adds detection for
symfony/ux-twig-componentandsymfony/ux-live-componentattributes to prevent false positives on members used by the framework at runtime.Properties:
#[LiveProp]— marked as READ + WRITE (hydrated/dehydrated by framework)#[ExposeInTemplate]— marked as READMethods:
mount()on#[AsTwigComponent]/#[AsLiveComponent]classes#[PreMount],#[PostMount]lifecycle hooks#[ExposeInTemplate]on methods#[LiveAction](also covers#[LiveListener]viaIS_INSTANCEOF)#[PostHydrate],#[PreDehydrate],#[PreReRender]lifecycle hooksMethod references from attribute arguments:
#[LiveProp(hydrateWith/dehydrateWith/onUpdated/modifier/fieldName)]#[ExposeInTemplate(getter)]#[AsLiveComponent(defaultAction)]All attribute handling was verified against the actual vendor source code in
symfony/ux-live-componentv2.34 andsymfony/ux-twig-componentv2.34.Test plan
symfony-ux.phpwithAlertComponent(TwigComponent),CounterComponent(LiveComponent), andCustomActionComponent(LiveComponent with attribute arguments)composer checkpasses (PHPStan, tests, coverage, CS, dependencies)Co-Authored-By: Claude Code