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

False positive: "Anonymous function should return ... but returns ... " #14914

Description

@staabm

Bug report

for some reason we have a false positive in the preg_replace_callback callback

Code snippet that reproduces the problem

https://phpstan.org/r/c3d20778-d776-462f-b544-c98fed1333a0

same problem in array-function style callback: https://phpstan.org/r/afe20725-1ad2-4a7d-8043-ed517d3499d8

Expected output

no error regarding anonymous function return type. in the context of preg_replace_callback we cannot infer which constant return type this callback should have.

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions