|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #81474 Make ReflectionEnum and related class non-final
Submitted: 2021-09-24 11:28 UTC Modified: -
Avg. Score:4.5 ± 0.9
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:3 (75.0%)
From: ondrej at mirtes dot cz Assigned:
Status: Closed Package: Reflection related
PHP Version: 8.1.0RC2 OS: N/A
Private report: No CVE-ID: None
 [2021-09-24 11:28 UTC] ondrej at mirtes dot cz
Library Roave/BetterReflection ( has a goal of providing runtime reflection compatible API for PHP reflection classes in the Adapter namespace:

This feature is prominently used by PHPStan, and maybe other open-source users as well.

In order for BetterReflection library to be able to be used in place of the official API via polymorphism, it needs to have the ability to extend core reflection classes like ReflectionClass and ReflectionMethod. It has been doing that successfully.

PHP 8.1 introduces ReflectionEnum class, and unfortunately it's final. This change request is about making this class non-final, and also all classes accessible through that one like ReflectionEnumPureCase, ReflectionEnumBackedCase, and ReflectionEnumUnitCase.


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-09-25 07:01 UTC] kukulich at kukulich dot cz
There's also a problem with ReflectionAttribute. It would be perfect to remove the final for it too. I think it could be done even in PHP 8 because the change is backward compatible.
 [2021-09-27 14:39 UTC]
The following pull request has been associated:

Patch Name: Make Reflection(Attribute|Enum|EnumBackedCase) non-final
On GitHub:
 [2021-09-28 07:38 UTC]
Automatic comment on behalf of nikic
Log: Fix bug #81474: Make Reflection(Attribute|Enum|EnumBackedCase) non-final
 [2021-09-28 07:38 UTC]
-Status: Open +Status: Closed
 [2021-10-04 12:41 UTC]
Automatic comment on behalf of sasezaki (author) and nikic (committer)
Log: Fix bug #81474: Make ReflectionAttribute non-final
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 19 08:01:28 2024 UTC