Skip to content

false-positive: Call to static method PHPUnit\Framework\Assert::assertCount() with int<0, max> and array will always evaluate to true #332

Description

@dontub

With the method below phpstan since lately reports the false-positive "Call to static method PHPUnit\Framework\Assert::assertCount() with int<0, max> and array will always evaluate to true."

/**
 * @param array<int|string> $expectedKeys
 * @param array<mixed> $actual
 */
public static function assertArrayHasSameKeys(array $expectedKeys, array $actual): void {
  \PHPUnit\Framework\Assert::assertCount(count($expectedKeys), $actual);
  // ...
}

Used versions:
phpstan/phpstan 2.2.14
phpstan/phpstan-phpunit 2.0.18

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions