Skip to content

Commit

Permalink
Merge branch '10.5' into 11.5
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 12, 2024
2 parents 4eee5de + 54ae58f commit 8b7e5b8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
7 changes: 7 additions & 0 deletions ChangeLog-11.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes of the PHPUnit 11.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.

## [11.5.2] - 2024-MM-DD

### Fixed

* [#6082](https://github.com/sebastianbergmann/phpunit/issues/6082): `assertArrayHasKey()`, `assertArrayNotHasKey()`, `arrayHasKey()`, and `ArrayHasKey::__construct()` do not support all possible key types

## [11.5.1] - 2024-12-11

### Added
Expand Down Expand Up @@ -37,5 +43,6 @@ All notable changes of the PHPUnit 11.5 release series are documented in this fi
* [#6055](https://github.com/sebastianbergmann/phpunit/issues/6055): `assertNotContainsOnly()` (use `assertContainsNotOnlyArray()`, `assertContainsNotOnlyBool()`, `assertContainsNotOnlyCallable()`, `assertContainsNotOnlyFloat()`, `assertContainsNotOnlyInt()`, `assertContainsNotOnlyIterable()`, `assertContainsNotOnlyNumeric()`, `assertContainsNotOnlyObject()`, `assertContainsNotOnlyResource()`, `assertContainsNotOnlyClosedResource()`, `assertContainsNotOnlyScalar()`, or `assertContainsNotOnlyString()` instead)
* [#6059](https://github.com/sebastianbergmann/phpunit/issues/6059): `containsOnly()` (use `containsOnlyArray()`, `containsOnlyBool()`, `containsOnlyCallable()`, `containsOnlyFloat()`, `containsOnlyInt()`, `containsOnlyIterable()`, `containsOnlyNumeric()`, `containsOnlyObject()`, `containsOnlyResource()`, `containsOnlyClosedResource()`, `containsOnlyScalar()`, or `containsOnlyString()` instead)

[11.5.2]: https://github.com/sebastianbergmann/phpunit/compare/11.5.1...11.5
[11.5.1]: https://github.com/sebastianbergmann/phpunit/compare/11.5.0...11.5.1
[11.5.0]: https://github.com/sebastianbergmann/phpunit/compare/11.4.4...11.5.0
6 changes: 3 additions & 3 deletions src/Framework/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ final public static function assertArrayIsIdenticalToArrayIgnoringListOfKeys(arr
* @throws Exception
* @throws ExpectationFailedException
*/
final public static function assertArrayHasKey(int|string $key, array|ArrayAccess $array, string $message = ''): void
final public static function assertArrayHasKey(mixed $key, array|ArrayAccess $array, string $message = ''): void
{
$constraint = new ArrayHasKey($key);

Expand All @@ -185,7 +185,7 @@ final public static function assertArrayHasKey(int|string $key, array|ArrayAcces
* @throws Exception
* @throws ExpectationFailedException
*/
final public static function assertArrayNotHasKey(int|string $key, array|ArrayAccess $array, string $message = ''): void
final public static function assertArrayNotHasKey(mixed $key, array|ArrayAccess $array, string $message = ''): void
{
$constraint = new LogicalNot(
new ArrayHasKey($key),
Expand Down Expand Up @@ -2865,7 +2865,7 @@ final public static function containsOnlyInstancesOf(string $className): Travers
return new TraversableContainsOnly($className, false);
}

final public static function arrayHasKey(int|string $key): ArrayHasKey
final public static function arrayHasKey(mixed $key): ArrayHasKey
{
return new ArrayHasKey($key);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Framework/Assert/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function assertArrayIsIdenticalToArrayIgnoringListOfKeys(array $expected, array
*
* @see Assert::assertArrayHasKey
*/
function assertArrayHasKey(int|string $key, array|ArrayAccess $array, string $message = ''): void
function assertArrayHasKey(mixed $key, array|ArrayAccess $array, string $message = ''): void
{
Assert::assertArrayHasKey(...func_get_args());
}
Expand All @@ -185,7 +185,7 @@ function assertArrayHasKey(int|string $key, array|ArrayAccess $array, string $me
*
* @see Assert::assertArrayNotHasKey
*/
function assertArrayNotHasKey(int|string $key, array|ArrayAccess $array, string $message = ''): void
function assertArrayNotHasKey(mixed $key, array|ArrayAccess $array, string $message = ''): void
{
Assert::assertArrayNotHasKey(...func_get_args());
}
Expand Down Expand Up @@ -3093,7 +3093,7 @@ function containsOnlyInstancesOf(string $className): TraversableContainsOnly
}

if (!function_exists('PHPUnit\Framework\arrayHasKey')) {
function arrayHasKey(int|string $key): ArrayHasKey
function arrayHasKey(mixed $key): ArrayHasKey
{
return Assert::arrayHasKey(...func_get_args());
}
Expand Down
4 changes: 2 additions & 2 deletions src/Framework/Constraint/Traversable/ArrayHasKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
*/
final class ArrayHasKey extends Constraint
{
private readonly int|string $key;
private readonly mixed $key;

public function __construct(int|string $key)
public function __construct(mixed $key)
{
$this->key = $key;
}
Expand Down

0 comments on commit 8b7e5b8

Please sign in to comment.