Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
alexander-schranz opened this issue Nov 13, 2019 · 5 comments
Closed
Labels
Milestone

Comments

@alexander-schranz
Copy link

alexander-schranz commented Nov 13, 2019

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.

@mergeable
Copy link

mergeable bot commented Nov 13, 2019

This bug report is missing a link to reproduction on phpstan.org.
It will most likely be closed after manual review.

@snapshotpl
Copy link

I have just go here to add same issue but I see there is more affected users. psalm works correctly with this.

@Jean85
Copy link
Contributor

Jean85 commented Nov 19, 2019

I have the same error, here's the playground example: https://phpstan.org/r/b5fd0536-7a9a-4fa3-bf52-ea28d7abeffd

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone May 21, 2020
@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@a599eaa

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants