Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
add assertIsNullableArray
Browse files Browse the repository at this point in the history
  • Loading branch information
Gummibeer committed Mar 22, 2020
1 parent 7543f61 commit d030b83
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/PHPUnit/Assertions/NullableTypeAssertions.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,16 @@ public static function assertIsNullableFloat($actual, ?string $message = null):
$message ?? "Failed to assert that \"{$actual}\" is type of null|float."
);
}

/**
* @param array|mixed|null $actual
* @param string|null $message
*/
public static function assertIsNullableArray($actual, ?string $message = null): void
{
PHPUnit::assertTrue(
is_null($actual) || is_array($actual),
$message ?? "Failed to assert that \"{$actual}\" is type of null|array."
);
}
}

0 comments on commit d030b83

Please sign in to comment.