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

未关闭 适合新手
#710 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
86/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
php, typescript
领域
cli

调研方向

从 src/core-open/scanners/php-scanner.ts 中的 parseComposerJson 和 test/php-config-platform-runtime.test.ts 中的测试开始。追踪 Composer 运行时值的选择方式,然后为 issue 中描述的 pin 文件优先级、token 解析、注释、空行和不可读文件补充测试覆盖。验收用例通过,并且缺少或无法读取的 pin 文件不会导致扫描失败时,即为完成。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
TypeScript
星标
4
派生
3
平均合并
1 天 22 小时
30 天内合并 PR
76

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

vibgrate/cli 的其他 Issue

查看 vibgrate/cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。