Skip to content

Commit f2ae8a3

Browse files
committed
Fix bug #81474: Make Reflection(Attribute|Enum|EnumBackedCase) non-final
BetterReflection would like to extend these classes to provide adaptors. As our other Reflector classes are non-final, I think it makes sense to make these non-final as well. Closes GH-7520.
1 parent f81f874 commit f2ae8a3

File tree

4 files changed

+6
-17
lines changed

4 files changed

+6
-17
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ PHP NEWS
99
- Reflection:
1010
. Fixed bug #81457 (Enum: ReflectionMethod->getDeclaringClass() return a
1111
ReflectionClass). (Nikita)
12+
. Fixed bug #81474 (Make ReflectionEnum and related class non-final). (Nikita)
1213

1314
- XML:
1415
. Fixed bug #70962 (XML_OPTION_SKIP_WHITE strips embedded whitespace).

ext/reflection/php_reflection.stub.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ private function __construct() {}
696696
}
697697

698698
/** @not-serializable */
699-
final class ReflectionAttribute implements Reflector
699+
class ReflectionAttribute implements Reflector
700700
{
701701
public function getName(): string {}
702702
public function getTarget(): int {}
@@ -711,7 +711,7 @@ private function __clone(): void {}
711711
private function __construct() {}
712712
}
713713

714-
final class ReflectionEnum extends ReflectionClass
714+
class ReflectionEnum extends ReflectionClass
715715
{
716716
public function __construct(object|string $objectOrClass) {}
717717

@@ -739,7 +739,7 @@ public function getEnum(): ReflectionEnum {}
739739
public function getValue(): UnitEnum {}
740740
}
741741

742-
final class ReflectionEnumBackedCase extends ReflectionEnumUnitCase
742+
class ReflectionEnumBackedCase extends ReflectionEnumUnitCase
743743
{
744744
public function __construct(object|string $class, string $constant) {}
745745

ext/reflection/php_reflection_arginfo.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 2316b7245c77ca2a5dd8baef53002c890eab162e */
2+
* Stub hash: 0b5887f75bd4ff4935aaa5bbdbe1c18f970525c2 */
33

44
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 1, IS_ARRAY, 0)
55
ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0)
@@ -1452,7 +1452,7 @@ static zend_class_entry *register_class_ReflectionAttribute(zend_class_entry *cl
14521452

14531453
INIT_CLASS_ENTRY(ce, "ReflectionAttribute", class_ReflectionAttribute_methods);
14541454
class_entry = zend_register_internal_class_ex(&ce, NULL);
1455-
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE;
1455+
class_entry->ce_flags |= ZEND_ACC_NOT_SERIALIZABLE;
14561456
zend_class_implements(class_entry, 1, class_entry_Reflector);
14571457

14581458
return class_entry;
@@ -1464,7 +1464,6 @@ static zend_class_entry *register_class_ReflectionEnum(zend_class_entry *class_e
14641464

14651465
INIT_CLASS_ENTRY(ce, "ReflectionEnum", class_ReflectionEnum_methods);
14661466
class_entry = zend_register_internal_class_ex(&ce, class_entry_ReflectionClass);
1467-
class_entry->ce_flags |= ZEND_ACC_FINAL;
14681467

14691468
return class_entry;
14701469
}
@@ -1485,7 +1484,6 @@ static zend_class_entry *register_class_ReflectionEnumBackedCase(zend_class_entr
14851484

14861485
INIT_CLASS_ENTRY(ce, "ReflectionEnumBackedCase", class_ReflectionEnumBackedCase_methods);
14871486
class_entry = zend_register_internal_class_ex(&ce, class_entry_ReflectionEnumUnitCase);
1488-
class_entry->ce_flags |= ZEND_ACC_FINAL;
14891487

14901488
return class_entry;
14911489
}

ext/reflection/tests/ReflectionAttribute_final.phpt

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)