From 6f26cabf4a8ec3e015ae452d5e022cf898ba75af Mon Sep 17 00:00:00 2001 From: mgiraud Date: Wed, 23 Sep 2026 10:00:48 +0200 Subject: [PATCH 1/2] ref#136 Check length of args array before using it --- src/Visitor/Php/Symfony/FormTypeLabelImplicit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Visitor/Php/Symfony/FormTypeLabelImplicit.php b/src/Visitor/Php/Symfony/FormTypeLabelImplicit.php index 72f78bb..81555c1 100644 --- a/src/Visitor/Php/Symfony/FormTypeLabelImplicit.php +++ b/src/Visitor/Php/Symfony/FormTypeLabelImplicit.php @@ -34,7 +34,7 @@ public function enterNode(Node $node): ?Node if ($node instanceof Node\Expr\MethodCall && (!\is_object($node->name) || method_exists($node->name, '__toString')) && ('add' === (string) $node->name || 'create' === (string) $node->name) - && $node->args[0]->value instanceof Node\Scalar\String_) { + && count($node->args) > 0 && $node->args[0]->value instanceof Node\Scalar\String_) { $skipLabel = false; // Check if the form type is "hidden" if (\count($node->args) >= 2) { From d5f3a03c030db1376c50f71f2ed5682f1fe9cc23 Mon Sep 17 00:00:00 2001 From: mgiraud Date: Wed, 23 Sep 2026 10:02:39 +0200 Subject: [PATCH 2/2] ref#136 Fix CS --- src/Visitor/Php/Symfony/FormTypeLabelImplicit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Visitor/Php/Symfony/FormTypeLabelImplicit.php b/src/Visitor/Php/Symfony/FormTypeLabelImplicit.php index 81555c1..1821878 100644 --- a/src/Visitor/Php/Symfony/FormTypeLabelImplicit.php +++ b/src/Visitor/Php/Symfony/FormTypeLabelImplicit.php @@ -34,7 +34,7 @@ public function enterNode(Node $node): ?Node if ($node instanceof Node\Expr\MethodCall && (!\is_object($node->name) || method_exists($node->name, '__toString')) && ('add' === (string) $node->name || 'create' === (string) $node->name) - && count($node->args) > 0 && $node->args[0]->value instanceof Node\Scalar\String_) { + && \count($node->args) > 0 && $node->args[0]->value instanceof Node\Scalar\String_) { $skipLabel = false; // Check if the form type is "hidden" if (\count($node->args) >= 2) {