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

Refine return type of preg_filter() #6664

Closed
arnaud-lb opened this issue Feb 17, 2022 · 2 comments · Fixed by phpstan/phpstan-src#1024
Closed

Refine return type of preg_filter() #6664

arnaud-lb opened this issue Feb 17, 2022 · 2 comments · Fixed by phpstan/phpstan-src#1024

Comments

@arnaud-lb
Copy link
Contributor

arnaud-lb commented Feb 17, 2022

Feature request

preg_filter() can return a string or an array of string depending on the type of its 3rd parameter.

It would be useful to refine the return type based on the 3rd parameter.

https://phpstan.org/r/43423551-a7d4-42fa-98ec-44a484c355af

@staabm
Copy link
Contributor

staabm commented Feb 18, 2022

on it..

I think the expected value for PHPStan\Testing\assertType('array|null', preg_filter(['#foo#'], ['bar'], ['subject'])); within the snippet is wrong, as preg_filter will not return null when $subject is a array

@github-actions
Copy link

github-actions bot commented Apr 3, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants