diff --git a/src/Expectation.php b/src/Expectation.php index 5741823f..8f072d57 100644 --- a/src/Expectation.php +++ b/src/Expectation.php @@ -344,14 +344,12 @@ final class Expectation if (is_object($this->value)) { if (method_exists($this->value, 'toArray')) { - $array = $this->value->toArray(); + $this->value = $this->value->toArray(); } else { - $array = (array) $this->value; + $this->value = (array) $this->value; } - Assert::assertCount($number, $array); - - return $this; + return $this->toHaveCount($number); } throw new BadMethodCallException('Expectation value length is not countable.');