Enhancement: fall back to `.php-version` and `.tool-versions` for the PHP runtime

Đang mở Phù hợp với người mới
#710 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

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

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
86/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php, typescript
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu với parseComposerJson trong src/core-open/scanners/php-scanner.ts và các bài kiểm thử trong test/php-config-platform-runtime.test.ts. Theo dõi cách các giá trị runtime của Composer được chọn, sau đó bổ sung phạm vi kiểm thử cho thứ tự ưu tiên của tệp pin, việc phân tích token, chú thích, dòng trống và các tệp không thể đọc được mô tả trong issue. Hoàn tất khi các trường hợp chấp nhận đều đạt và tệp pin bị thiếu hoặc không thể đọc được không làm quá trình quét thất bại.

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

Mô tả

enhancement good first issue
  • Difficulty: small
  • Area: PHP scanner
Problem

parseComposerJson in src/core-open/scanners/php-scanner.ts (around lines 102–107) takes the PHP runtime only from require.php, then config.platform.php (#647). A project that pins the interpreter with phpenv or asdf, and does not declare those Composer keys, reports no runtime:

# .php-version
8.3.12

# .tool-versions
php 8.3.12
Expected behaviour

When require.php and config.platform.php are both absent, read .php-version in the same directory as composer.json, then .tool-versions. Use the first version token (8.3, 8.3.12; drop a leading v). Skip system and other non-version tokens. require.php still wins over config.platform.php, which still wins over the pin files. .php-version wins over .tool-versions. A missing or unreadable pin file never fails the scan.

Acceptance
  • Add tests next to test/php-config-platform-runtime.test.ts.
  • Cases: only .php-version; only .tool-versions (php 8.3.12); both (.php-version wins); require.php present (Composer wins); config.platform.php present and no require.php (platform wins); a system entry yields no runtime; comments and blank lines are ignored.

Ngôn ngữ chính
TypeScript
Star
4
Fork
3
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
76

Chuẩn bị môi trường

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 vibgrate/cli

Tất cả issue của vibgrate/cli

Issue tương tự

Thêm issue về TypeScript

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.