php.net |  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: -
Votes:4
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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
49 - 14 = ?
Subscribe to this entry?

 
 [2021-09-24 11:28 UTC] ondrej at mirtes dot cz
Description:
------------
Library Roave/BetterReflection (https://github.com/Roave/BetterReflection) has a goal of providing runtime reflection compatible API for PHP reflection classes in the Adapter namespace: https://github.com/Roave/BetterReflection/tree/5.0.x/src/Reflection/Adapter

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.


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

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] nikic@php.net
The following pull request has been associated:

Patch Name: Make Reflection(Attribute|Enum|EnumBackedCase) non-final
On GitHub:  https://github.com/php/php-src/pull/7520
Patch:      https://github.com/php/php-src/pull/7520.patch
 [2021-09-28 07:38 UTC] git@php.net
Automatic comment on behalf of nikic
Revision: https://github.com/php/php-src/commit/f2ae8a33578f21d29d3bbc81d146fe93dd616506
Log: Fix bug #81474: Make Reflection(Attribute|Enum|EnumBackedCase) non-final
 [2021-09-28 07:38 UTC] git@php.net
-Status: Open +Status: Closed
 [2021-10-04 12:41 UTC] git@php.net
Automatic comment on behalf of sasezaki (author) and nikic (committer)
Revision: https://github.com/php/php-src/commit/e286313fa7a134c382e486566c52a0ff583fb2d1
Log: Fix bug #81474: Make ReflectionAttribute non-final
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 14:01:31 2024 UTC