Skip to content

Add support for Symfony UX Twig Component and Live Component attributes#329

Merged
janedbal merged 3 commits intomasterfrom
symfony-ux-components
Apr 8, 2026
Merged

Add support for Symfony UX Twig Component and Live Component attributes#329
janedbal merged 3 commits intomasterfrom
symfony-ux-components

Conversation

@janedbal
Copy link
Copy Markdown
Member

@janedbal janedbal commented Apr 7, 2026

Summary

Closes #328

Adds detection for symfony/ux-twig-component and symfony/ux-live-component attributes 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 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)]

All attribute handling was verified against the actual vendor source code in symfony/ux-live-component v2.34 and symfony/ux-twig-component v2.34.

Test plan

  • New test fixture symfony-ux.php with AlertComponent (TwigComponent), CounterComponent (LiveComponent), and CustomActionComponent (LiveComponent with attribute arguments)
  • Dead members included as negative test cases
  • composer check passes (PHPStan, tests, coverage, CS, dependencies)

Co-Authored-By: Claude Code

janedbal added 3 commits April 8, 2026 11:40
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
@janedbal janedbal force-pushed the symfony-ux-components branch from 92645b0 to 30eb2c6 Compare April 8, 2026 09:40
@janedbal janedbal merged commit dd909a6 into master Apr 8, 2026
32 checks passed
@janedbal janedbal deleted the symfony-ux-components branch April 8, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Symfony UX Twig Component and Live Component attributes

1 participant