diff --git a/.psalm/baseline.xml b/.psalm/baseline.xml
index c959447258d..6c8580d8381 100644
--- a/.psalm/baseline.xml
+++ b/.psalm/baseline.xml
@@ -152,10 +152,6 @@
static::assertThat($haystack, $constraint, $message)
static::assertThat($haystack, $constraint, $message)
-
- $expected
- $expected
-
diff --git a/src/Framework/Constraint/Cardinality/Count.php b/src/Framework/Constraint/Cardinality/Count.php
index 6ff3641b24c..c249c112346 100644
--- a/src/Framework/Constraint/Cardinality/Count.php
+++ b/src/Framework/Constraint/Cardinality/Count.php
@@ -10,10 +10,9 @@
namespace PHPUnit\Framework\Constraint;
use function count;
-use function is_array;
+use function is_countable;
use function iterator_count;
use function sprintf;
-use Countable;
use EmptyIterator;
use Generator;
use Iterator;
@@ -57,7 +56,7 @@ protected function matches($other): bool
*/
protected function getCountOf($other): ?int
{
- if ($other instanceof Countable || is_array($other)) {
+ if (is_countable($other)) {
return count($other);
}
diff --git a/src/Framework/Constraint/Cardinality/SameSize.php b/src/Framework/Constraint/Cardinality/SameSize.php
index a54679425c0..51e39397a24 100644
--- a/src/Framework/Constraint/Cardinality/SameSize.php
+++ b/src/Framework/Constraint/Cardinality/SameSize.php
@@ -14,7 +14,10 @@
*/
final class SameSize extends Count
{
- public function __construct(iterable $expected)
+ /**
+ * @psalm-param \Countable|iterable $expected
+ */
+ public function __construct($expected)
{
parent::__construct((int) $this->getCountOf($expected));
}