From 06b0d9805ae703236185bda56a54f60b22760b08 Mon Sep 17 00:00:00 2001 From: adikalon Date: Tue, 16 Apr 2024 20:09:44 +0300 Subject: [PATCH] Component attributes on stempler (#22) --- src/Bootloader/ValidationBootloader.php | 2 +- src/Template/Stempler/NodeVisitor.php | 4 +++- .../component-renderer-test/components/counter.dark.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Bootloader/ValidationBootloader.php b/src/Bootloader/ValidationBootloader.php index 4df533c..8fd2635 100644 --- a/src/Bootloader/ValidationBootloader.php +++ b/src/Bootloader/ValidationBootloader.php @@ -45,7 +45,7 @@ private function initSymfonyValidator( FactoryInterface $factory ): SymfonyValidator { $validator = \Symfony\Component\Validator\Validation::createValidatorBuilder() - ->enableAnnotationMapping() + ->enableAttributeMapping() ->setConstraintValidatorFactory($constraintValidatorFactory); if ($container->has(TranslatorInterface::class)) { diff --git a/src/Template/Stempler/NodeVisitor.php b/src/Template/Stempler/NodeVisitor.php index ce0a1cb..1f9c0a7 100644 --- a/src/Template/Stempler/NodeVisitor.php +++ b/src/Template/Stempler/NodeVisitor.php @@ -25,9 +25,11 @@ public function enterNode(mixed $node, VisitorContext $ctx): mixed return $c; } + + return $node; } - return $node; + return null; } public function leaveNode(mixed $node, VisitorContext $ctx): mixed diff --git a/tests/views/template/stempler/component-renderer-test/components/counter.dark.php b/tests/views/template/stempler/component-renderer-test/components/counter.dark.php index 916571a..b0e83ff 100644 --- a/tests/views/template/stempler/component-renderer-test/components/counter.dark.php +++ b/tests/views/template/stempler/component-renderer-test/components/counter.dark.php @@ -1,4 +1,4 @@ -
+

{{ $count }}