Skip to content

Constant string are considered as executed callable when passed to a function #12119

@VincentLanglet

Description

@VincentLanglet

Bug report

Extracted from #12048 (comment)
simplified to https://phpstan.org/r/c4c14285-1a7a-4748-9fdd-526a134e693e

random_int is a constant string which might be used as any other string, but PHPStan consider that this is the random_int() method and this method is executed.

This seems "wanted" cf code in NodeScopeResolver
https://github.com/phpstan/phpstan-src/blob/2d637dab640f194f19b2c50a565b13e331c0227c/src/Analyser/NodeScopeResolver.php#L4635-L4644
but I'm unsure how.

Code snippet that reproduces the problem

https://phpstan.org/r/c4c14285-1a7a-4748-9fdd-526a134e693e

Expected output

I would expect no error, since random_int function is not called.
I might just concatenate this string or do anything else with it.

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

I dont consider working without PHPstan, this tool is awesome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions