Repository: phpactor/phpactor (php)

Issue:
Variadic: always shows as `array` in help
![image](https://github.com/phpactor/phpactor/assets/530801/02e1b9da-fd3e-4503-9517-7c7f80876d72)
![image](https://github.com/phpactor/phpactor/assets/530801/65f2cf0f-9f67-4282-84f9-db0a9d6b2527)


Pull request description:
Variadic
Fixes #2436 

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 19cfa3bd..b8d0afa9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ Bug fixes:
   - Fix autoloading class conflcits with test files #2535 @gerardroche
   - Fix crash on resolveItem() caused by race condition (?) #2434
   - Fix false positive for undefined var where vardoc not counting as variable definition #2437
+  - Render variadics as variadics in help, not as arrays #2448
 
 Features:
 
diff --git a/templates/help/markdown/Phpactor/WorseReflection/Core/Reflection/Collection/ReflectionParameterCollection.twig b/templates/help/markdown/Phpactor/WorseReflection/Core/Reflection/Collection/ReflectionParameterCollection.twig
index 07fbfba6..480de4ae 100644
--- a/templates/help/markdown/Phpactor/WorseReflection/Core/Reflection/Collection/ReflectionParameterCollection.twig
+++ b/templates/help/markdown/Phpactor/WorseReflection/Core/Reflection/Collection/ReflectionParameterCollection.twig
@@ -1,3 +1,7 @@
 {%- for parameter in object -%}
+{% if parameter.isVariadic %}
+{% if typeDefined(parameter.type) and attribute(parameter.type, 'iterableValueType') is defined %}{{- render(parameter.type.iterableValueType) }} {% endif %}...${{- parameter.name -}}{% if not loop.last %}, {% endif %}
+{% else %}
 {% if typeDefined(parameter.inferredType) %}{{- render(parameter.inferredType) }} {% endif %}${{- parameter.name -}}{% if not loop.last %}, {% endif %}
+{% endif %}
 {%- endfor -%}


Test patch:
diff --git a/lib/Extension/LanguageServerCompletion/Tests/Integration/MarkdownObjectRendererTest.php b/lib/Extension/LanguageServerCompletion/Tests/Integration/MarkdownObjectRendererTest.php
index ab908185..62381f73 100644
--- a/lib/Extension/LanguageServerCompletion/Tests/Integration/MarkdownObjectRendererTest.php
+++ b/lib/Extension/LanguageServerCompletion/Tests/Integration/MarkdownObjectRendererTest.php
@@ -459,6 +459,41 @@ class MarkdownObjectRendererTest extends IntegrationTestCase
             },
             'method8.md'
         ];
+
+        yield 'method variadic ' => [
+            '',
+            function (Reflector $reflector) {
+                return $this->reflectClassesIn(
+                    $reflector,
+                    <<<'EOT'
+                        <?php
+
+                        class OneClass
+                        {
+                            public function foo(Foobar ...$foo) {}
+                        }
+                        EOT
+                )->get('OneClass')->methods()->get('foo');
+            },
+            'method_variadic.md',
+        ];
+        yield 'method variadic no type' => [
+            '',
+            function (Reflector $reflector) {
+                return $this->reflectClassesIn(
+                    $reflector,
+                    <<<'EOT'
+                        <?php
+
+                        class OneClass
+                        {
+                            public function foo(...$foo) {}
+                        }
+                        EOT
+                )->get('OneClass')->methods()->get('foo');
+            },
+            'method_variadic_no_type.md',
+        ];
     }
 
     /**
diff --git a/lib/Extension/LanguageServerCompletion/Tests/Integration/expected/method_variadic.md b/lib/Extension/LanguageServerCompletion/Tests/Integration/expected/method_variadic.md
new file mode 100644
index 00000000..83a8dfb7
--- /dev/null
+++ b/lib/Extension/LanguageServerCompletion/Tests/Integration/expected/method_variadic.md
@@ -0,0 +1,1 @@
+public function foo(Foobar ...$foo)
diff --git a/lib/Extension/LanguageServerCompletion/Tests/Integration/expected/method_variadic_no_type.md b/lib/Extension/LanguageServerCompletion/Tests/Integration/expected/method_variadic_no_type.md
new file mode 100644
index 00000000..dc977679
--- /dev/null
+++ b/lib/Extension/LanguageServerCompletion/Tests/Integration/expected/method_variadic_no_type.md
@@ -0,0 +1,1 @@
+public function foo(<missing> ...$foo)