Skip to content

False positive “Expression … on a separate line does not do anything.” for callable invocation #13067

@mibk

Description

@mibk

Bug report

PHPStan reports a false-positive error when calling a variable holding a closure on its own line. The analyzer incorrectly believes the invocation is a no-op expression rather than a function call that may have side effects (e.g. output).

Code snippet that reproduces the problem

https://phpstan.org/r/38fa9abe-cdc6-4ffa-b509-783d834a0f3c

Expected output

It was a false positive.

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions