Skip to content

Make Reflection(Attribute|Enum|EnumBackedCase) non-final #7520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ext/reflection/php_reflection.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ private function __construct() {}
}

/** @not-serializable */
final class ReflectionAttribute implements Reflector
class ReflectionAttribute implements Reflector
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReflectionAttribute exists since PHP 8.0, can we target this version as per https://bugs.php.net/bug.php?id=81474#1632553296 comment?

{
public function getName(): string {}
public function getTarget(): int {}
Expand All @@ -711,7 +711,7 @@ private function __clone(): void {}
private function __construct() {}
}

final class ReflectionEnum extends ReflectionClass
class ReflectionEnum extends ReflectionClass
{
public function __construct(object|string $objectOrClass) {}

Expand Down Expand Up @@ -739,7 +739,7 @@ public function getEnum(): ReflectionEnum {}
public function getValue(): UnitEnum {}
}

final class ReflectionEnumBackedCase extends ReflectionEnumUnitCase
class ReflectionEnumBackedCase extends ReflectionEnumUnitCase
{
public function __construct(object|string $class, string $constant) {}

Expand Down
6 changes: 2 additions & 4 deletions ext/reflection/php_reflection_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 2316b7245c77ca2a5dd8baef53002c890eab162e */
* Stub hash: 0b5887f75bd4ff4935aaa5bbdbe1c18f970525c2 */

ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 1, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0)
Expand Down Expand Up @@ -1452,7 +1452,7 @@ static zend_class_entry *register_class_ReflectionAttribute(zend_class_entry *cl

INIT_CLASS_ENTRY(ce, "ReflectionAttribute", class_ReflectionAttribute_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE;
class_entry->ce_flags |= ZEND_ACC_NOT_SERIALIZABLE;
zend_class_implements(class_entry, 1, class_entry_Reflector);

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

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

return class_entry;
}
Expand All @@ -1485,7 +1484,6 @@ static zend_class_entry *register_class_ReflectionEnumBackedCase(zend_class_entr

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

return class_entry;
}
Expand Down
10 changes: 0 additions & 10 deletions ext/reflection/tests/ReflectionAttribute_final.phpt

This file was deleted.