Array construct/destruct should warn at least for duplicate keys
未关闭
还没有人认领这个 Issue。
Feature
Status: Requires RFC
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
$arr = ['4', 'x' => 5];
// construct with duplicate keys
var_dump(['x' => 4, 'x' => 6]);
var_dump([2 => 4, 2.0 => 6]);
// spread operator leading to duplicate keys
var_dump(['x' => 4, ...$arr]);
// destruct with duplicate keys (it is safe to do, but if same key should be assigned to another variable too, it can be done after the destruct)
['x' => $a, 'x' => $b] = ['x' => 10];
var_dump([$a, $b]);
all cases should emit at least warning if not an error
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先复现 issue 中关于重复键构造、spread 和解构的示例,包括链接的 3v4l.org 案例。跟踪 PHP 解释器对数组键的处理,并确定相关的测试或入口点;完成的标准是列出的每个重复键案例至少发出警告或错误。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- php
- 领域
- compilers
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100