Skip to content

Dynamic function call produces arguments.count error #13054

Closed

Description

@JulienChavee

Bug report

We have phpstan reporting false positive errors for dynamically function calls, when calls are conditioned with some checks before the call, based on the a variable that is used to know which function will be called.

To avoid the error, I changed the "if" condition to match the complete function name that is called

Code snippet that reproduces the problem

https://phpstan.org/r/8d1e0f7e-2776-4e9d-ab9e-d393ce6b8dab

Expected output

It should not report error there

Did PHPStan help you today? Did it make you happy in any way?

No response

Activity

  1. VincentLanglet commented on May 21, 2025

    @VincentLanglet
    Contributor

    https://phpstan.org/r/894d9788-c385-4d2f-8a0d-68336041e32e might help understanding the issue.

    Seems like the conditional type (between the key and the value) exists, but is lost with the concatenation.

    So currently you can do https://phpstan.org/r/5db97425-1de0-47a1-a388-284878b02ac3

  2. added this to the Dependent types milestone on Jul 22, 2025
  3. phpstan-bot commented on Sep 11, 2026

    @phpstan-bot
    Contributor

    Closed via merging phpstan/phpstan-src#6381

  4. github-actions commented on Oct 13, 2026

    @github-actions

    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.

  5. locked as resolved and limited conversation to collaborators on Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions