1111
1212namespace Symfony \UX \TwigComponent \Twig ;
1313
14- use Symfony \UX \TwigComponent \CVA ;
15- use Twig \DeprecatedCallableInfo ;
1614use Twig \Extension \AbstractExtension ;
1715use Twig \TwigFunction ;
1816
@@ -27,11 +25,6 @@ public function getFunctions(): array
2725 {
2826 return [
2927 new TwigFunction ('component ' , [ComponentRuntime::class, 'render ' ], ['is_safe ' => ['all ' ]]),
30- new TwigFunction ('cva ' , [$ this , 'cva ' ], [
31- ...(class_exists (DeprecatedCallableInfo::class)
32- ? ['deprecation_info ' => new DeprecatedCallableInfo ('symfony/ux-twig-component ' , '2.20 ' , 'html_cva ' , 'twig/html-extra ' )]
33- : ['deprecated ' => '2.20 ' , 'deprecating_package ' => 'symfony/ux-twig-component ' , 'alternative ' => 'html_cva ' ]),
34- ]),
3528 ];
3629 }
3730
@@ -42,33 +35,4 @@ public function getTokenParsers(): array
4235 new PropsTokenParser (),
4336 ];
4437 }
45-
46- /**
47- * Create a CVA instance.
48- *
49- * base some base class you want to have in every matching recipes
50- * variants your recipes class
51- * compoundVariants compounds allow you to add extra class when multiple variation are matching in the same time
52- * defaultVariants allow you to add a default class when no recipe is matching
53- *
54- * @see https://symfony.com/bundles/ux-twig-component/current/index.html#component-with-complex-variants-cva
55- *
56- * @param array{
57- * base: string|string[]|null,
58- * variants: array<string, array<string, string|string[]>>,
59- * compoundVariants: list<array<string, string|string[]>>,
60- * defaultVariants: array<string, string>,
61- * } $cva
62- */
63- public function cva (array $ cva ): CVA
64- {
65- trigger_deprecation ('symfony/ux-twig-component ' , '2.20 ' , 'Twig Function "cva" is deprecated; use "html_cva" from the "twig/html-extra" package (available since version 3.12) instead. ' );
66-
67- return new CVA (
68- $ cva ['base ' ] ?? '' ,
69- $ cva ['variants ' ] ?? [],
70- $ cva ['compoundVariants ' ] ?? [],
71- $ cva ['defaultVariants ' ] ?? [],
72- );
73- }
7438}
0 commit comments