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

Add null to array_map(null, $a, $b) #3562

Open
wants to merge 2 commits into
base: 1.12.x
Choose a base branch
from

Conversation

schlndh
Copy link
Contributor

@schlndh schlndh commented Oct 11, 2024

Fixes: https://3v4l.org/QKHrt (https://phpstan.org/r/357b09e6-80b7-4c50-97db-35995ff4cb67)

Unfortunately, since it depends on values of multiple variables at the same time (which may be correlated), there will be false positives like this:

if (rand()) {
	$a = [1];
	$b = [2];
} else {
	$a = [1, 2];
	$b = [3, 4];
}

array_map(null, $a, $b);

But I guess it's better to be safe than sorry. I at least added support for array_map(null, $a, $a).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant