Skip to content

✨ Add Symfony UX 3.x compatibility - #26

Merged
damienlagae merged 2 commits into
mainfrom
feat/symfony-ux-3-compat
Jun 10, 2026
Merged

damienlagae merged 2 commits into
mainfrom
feat/symfony-ux-3-compat

Conversation

@damienlagae

Copy link
Copy Markdown
Member

What

  • Widen symfony/ux-icons and symfony/ux-twig-component constraints to ^2.30|^3.0
  • Replace the cva Twig function (removed in TwigComponent 3.0) with plain class string building in alert, widget and callout templates
  • Bump PHPStan to 2.x (1.12 cannot parse symfony/http-foundation 8.1 sources)

Why not html_cva?

The upgrade guide suggests html_cva from twig/html-extra, but our usage is a trivial static type-to-class mapping. Manual concatenation avoids a new dependency and the extension registration requirement (twig/extra-bundle) in consuming apps. The cva branches in widget/callout were dead code anyway (cva is defined tests a variable, not the function), so the manual fallback already ran everywhere. Rendered HTML is unchanged.

Notes for consumers

  • No breaking change: PHP >= 8.3 and UX 2.30+ still supported
  • Apps upgrading to UX 3.x must define twig_component.defaults (mandatory in 3.0) and need PHP >= 8.4 / Symfony >= 7.4

Checks

  • 246 tests, 672 assertions OK
  • PHPStan level 8: no errors (against symfony 8.1 / ux 3.1)
  • php-cs-fixer: nothing to fix

Allow symfony/ux-icons and symfony/ux-twig-component ^2.30 or ^3.0.

The cva Twig function was removed in TwigComponent 3.0. Our usage was a
trivial static type-to-class mapping, so replace it with plain class
string building instead of pulling in twig/html-extra for html_cva.
The cva branches in widget and callout were dead code anyway: the
'cva is defined' guard tests a variable, never the function, so the
manual fallback already ran everywhere. Rendered HTML is unchanged.
PHPStan 1.12 cannot parse symfony/http-foundation 8.1 sources and
reports every Request/Response reference as an unknown class.
@damienlagae
damienlagae merged commit 0ce3406 into main Jun 10, 2026
7 checks passed
@damienlagae
damienlagae deleted the feat/symfony-ux-3-compat branch June 10, 2026 17:44
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.

1 participant