assertArrayHasKey()
, assertArrayNotHasKey()
, arrayHasKey()
, and ArrayHasKey::__construct()
do not support all possible key types
#6082
Labels
feature/assertion
Issues related to assertions and expectations
type/bug
Something is broken
version/10
Something affects PHPUnit 10
version/11
Something affects PHPUnit 11
version/12
Something affects PHPUnit 12
ArrayAccess
can usemixed
keys (see https://www.php.net/manual/en/class.arrayaccess.php), however,Assert::assertArrayHasKey()
,Assert::assertArrayNotHasKey()
accept onlyint|string
keys, which does not allow to test collections with object keys.I propose to change
int|string $key
tomixed $key
. This will not break BC, since the methods are final.The text was updated successfully, but these errors were encountered: