-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
phpstan/phpstan-src
#418Labels
Milestone
Description
I am getting a false positive when trying to add array with a combined array.
Here is the code with a link https://phpstan.org/r/e906bbea4b53a52babf61ce1deb1aa05
<?php declare(strict_types = 1);
$a1 = ['a', 'b', 'c'];
$a2 = [1, 2, 3];
$a3 = ['d', 'e', 'f'];
$combined = array_combine($a1, $a2);
$added = $a3 + $combined;
And the error message is:
Binary operation "+" between array('d', 'e', 'f') and array|false results in an error.
In the docs for array_combine(), it says
Returns the combined array, FALSE if the number of elements for each array isn't equal.
In this case, the number of elements are clearly the same. What do you suggest?
Reactions are currently unavailable