Skip to content

PHP8 array_uintersect false positive #4530

@Jurigag

Description

@Jurigag

Bug report

When using array_uintersect in PHP8 phpstan returns error:

Parameter #3 ...$rest of function array_uintersect expects array, string given.

However the same error is not returned when using PHP7. Also what is interesting here https://3v4l.org/4MMeU that reflection api reports other parameters of the function for PHP 8, maybe it's actually PHP bug?

Code snippet that reproduces the problem

<?php declare(strict_types = 1);

$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array2 = array("a" => "GREEN", "B" => "brown", "yellow", "red");

print_r(array_uintersect($array1, $array2, "strcasecmp"));

Here is link to playground - https://phpstan.org/r/fe236064-884e-48ae-bd28-fbd452c9ec7c

Expected output

No errors!

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