php / php/php-src

Enums should not be allowed to implement interfaces with properties in 8.4

未关闭
#16,447 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@DanielEScherzer 已经在做这个了。

开始于 2024年10月15日。

  • #16448 来自 @DanielEScherzer —— 未关闭
Bug Category: Engine
主要语言
C
星标
40.4k
派生
8.2k
平均合并
2 天 13 小时
30 天内合并 PR
96

描述

Description

The following code:

interface I
{
    public string $x { get; }
}

enum E implements I
{
}

Resulted in this output:

PHP Fatal error:  Enum E must implement 1 abstract private method (I::$x::get)

But I expected this output instead:

PHP Fatal error:  Enum E cannot implement interfaces with properties
PHP Version

PHP 8.4.0-dev (cli) (built: Sep 24 2024 14:38:59) (NTS)

Operating System

MacOS

贡献指南

打开贡献指南

从这里开始

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

调研方向

先从 issue 中展示的 PHP enum 和 interface 复现开始,然后检查已链接的 pull request #16448,因为这项工作已经在进行中。确认实现了带有 properties 的 interface 的 enum 会产生预期的 fatal error,而不是抽象方法诊断。

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

评估

技术栈
php
领域
compilers
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
25/100

把新 issue 发到你的邮箱

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