Skip to content

gen_stub.php: ignore variadic parameter in @param doc comment annotation #20277

@mitelg

Description

@mitelg

Description

The following class stub code:

<?php

class Foo
{
    /**
     * @param string ...$args This does not work
     */
    public function bar(string ...$args): void;
}

Executed with sudo php /usr/lib/php/20250925/build/gen_stub.php foo.stub.php
Resulted in this output:

In foo.stub.php:
Foo::bar(): @param doesn't contain a variable name or has an invalid format "string ...$args This does not work"

But I expected this output instead:
normal gen_stub.php output

Imo, the variadic syntax should be supported, as this is the way how also PHPStorm is writing it in the PHPDoc

PHP Version

PHP 8.5.0RC1 (cli) (built: Oct  1 2025 20:34:09) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.5.0RC1, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.0RC1, Copyright (c), by Zend Technologies

But all older versions also do not accept variadic parameters

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions