Enums should not be allowed to implement interfaces with properties in 8.4
Open
Bug
Category: Engine
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.2k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the PHP enum and interface reproduction shown in the issue, then inspect linked pull request #16448 because the work is already underway. Confirm that an enum implementing an interface with properties produces the expected fatal error rather than an abstract-method diagnostic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100