PHPUnit – assertCount() not returning same result

I am using assertCount() method within my Symfony project and PHPUnit Functional tests. I was refactoring a method, and suddenly I does not work any more. But I am not sure what could be a problem.

I wanted to move my method that I am using multiple times from one class:

public function testPostSuccessful(): void
{
    ... 
    // rest of the request code //

    $response = $this->client->getResponse();
    $responseBody = json_decode($response->getContent(), true);

    $this->assertArraySimilar($this->expected, $responseBody["data"][0]);

    $this->assertEquals(200, $response->getStatusCode());
}

And in my other method:

protected function assertArraySimilar(array $expected, array $array)
{
    // expected amount of key - value pairs are returned
    $this->assertCount(6, $array);
    
    ...
    // rest of the code //
}

This is throwing an error:

Failed asserting that actual size 2 matches expected size 6.

But when I dump the result like:

var_dump(count($array));die;

I get: int(6)

What could be the problem here?