mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
Merge pull request #930 from pestphp/feature/same-size-arg
[2.x] chore: resolve `toHaveSameSize` parameter
This commit is contained in:
@ -6,6 +6,7 @@ namespace Pest\Mixins;
|
|||||||
|
|
||||||
use BadMethodCallException;
|
use BadMethodCallException;
|
||||||
use Closure;
|
use Closure;
|
||||||
|
use Countable;
|
||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
use Error;
|
use Error;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
@ -275,10 +276,10 @@ final class Expectation
|
|||||||
/**
|
/**
|
||||||
* Asserts that the size of the value and $expected are the same.
|
* Asserts that the size of the value and $expected are the same.
|
||||||
*
|
*
|
||||||
* @param array<int|string, mixed> $expected
|
* @param Countable|iterable<mixed> $expected
|
||||||
* @return self<TValue>
|
* @return self<TValue>
|
||||||
*/
|
*/
|
||||||
public function toHaveSameSize(iterable $expected, string $message = ''): self
|
public function toHaveSameSize(Countable|iterable $expected, string $message = ''): self
|
||||||
{
|
{
|
||||||
if (! is_countable($this->value) && ! is_iterable($this->value)) {
|
if (! is_countable($this->value) && ! is_iterable($this->value)) {
|
||||||
InvalidExpectationValue::expected('countable|iterable');
|
InvalidExpectationValue::expected('countable|iterable');
|
||||||
|
|||||||
Reference in New Issue
Block a user