Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#332 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
testing-qa

Hướng nghiên cứu

Start by reproducing the reported assertCount call with the supplied PHPDoc types using phpstan/phpstan 2.2.14 and phpstan/phpstan-phpunit 2.0.18. Trace the PHPUnit assertCount rule or entry point that reports the diagnostic, then add or update a regression test so this valid call is no longer reported as always true.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

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

Ngôn ngữ chính
PHP
Star
544
Fork
58
Merge trung bình
2 ngày 1 giờ
Pull request đã merge (30 ngày)
5

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của phpstan/phpstan-phpunit

Tất cả issue của phpstan/phpstan-phpunit

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.