Skip to content

The ... variadic params is not detected correctly from the phpdocs #2600

@alexander-schranz

Description

@alexander-schranz

Bug report

The ... operator is not correctly detected in phpdocs.

Code snippet that reproduces the problem

Doctrine added ... lately the following to its phpdocs before it was without the ...:

/**
 * @param mixed ...$x
 *
 * @return CompositeExpression
 */
public function orX($x = null)
{
    return new CompositeExpression(CompositeExpression::TYPE_OR, func_get_args());
}

Errors with:

  124    Parameter #1 $x of method
         Doctrine\Common\Collections\ExpressionBuilder::orX() expects array<int,
         mixed>|null, Doctrine\Common\Collections\Expr\Comparison given.

https://phpstan.org/r/aba9598f-b904-479d-b95e-a83d41d875fe

Expected output

Should not error as the type sfor $parameter #1, .... should still be mixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions