Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support complex narrowing of type in array_filter #2751

Closed
noemi-salaun opened this issue Dec 18, 2019 · 2 comments
Closed

Support complex narrowing of type in array_filter #2751

noemi-salaun opened this issue Dec 18, 2019 · 2 comments

Comments

@noemi-salaun
Copy link

Feature request

PHPStan already support narrowing of type inside an array_filter but only with a single return statement.

See #482

But PhpStan is lost when using more complex logic.

See https://phpstan.org/r/cde7ee2a-72d9-4f98-9ec4-5e2c7b164da7

@ondrejmirtes
Copy link
Member

PHPStan is unlikely to understand all logic that's possible to implement inside array_filter callbacks. You can help yourself with a @var PHPDoc annotation: https://phpstan.org/r/103507ea-979c-411c-be29-c4df43e66895

@lock
Copy link

lock bot commented Jan 18, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants