🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

Introduce ClosureType::isStaticClosure #14639

Description

@VincentLanglet

Feature request

Method like Closure::bindTo() could return null for static closure but will never for non-static closure.
It would be interesting for multiple rule to keep the information if a closure is static or not.

We should introduce isStatic TrinaryLogic param in ClosureType constructor and a isStaticClosure method.
But it needs to be checked in equals, isSuperTypeOf and correctly merged.
Also when it’s not maybe, I argue it should also be in describe(), definitely in precise() and cache() levels

Some rules can react to it when it’s yes().
For example when passing a static closure to a function that has @param-closure-this .

It has to be extensive testing in TypeCombinator
Also might make sense to add isStaticClosure(): TrinaryLogic to CallableParametersAcceptor.

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

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions