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

"Anonymous function has an unused use $container" and include/require #14962

Description

@staabm

Feature request

I think we should not have a "unused use" error, because the variable might be used within the require'd file

https://phpstan.org/r/2fd91906-8c0b-42b7-a829-6c8b705ee78b

its a common pattern to isolate require/include scope from other local variables using such anonmous function.
we even used it in PHPStan-src itself:

https://github.com/phpstan/phpstan-src/blob/e911cc96ac19cc55b3c5a54d379fd59bc2ab0f7d/src/Command/CommandHelper.php#L643-L645

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