Skip to content

Let extensions mark classes final, abstract, or readonly - #69

Merged
nvms merged 1 commit into
mainfrom
extension-class-flags
Sep 13, 2026
Merged

nvms merged 1 commit into
mainfrom
extension-class-flags

Conversation

@nvms

@nvms nvms commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Fixes #67.

zphp_class_set_flags takes ZPHP_CLASS_FINAL, ZPHP_CLASS_ABSTRACT, or ZPHP_CLASS_READONLY and sets the same fields on the class definition that a PHP class declaration sets. The existing checks then apply: new on an abstract extension class throws, a class that extends a final one is a fatal error, and assigning a property of a readonly class throws. Passing final and abstract together returns an error. The function sits at the end of the API table, so extensions built against the previous header still load.

The demo extension registers a class of each kind and the extension suite checks them.

@nvms
nvms merged commit 4850405 into main Sep 13, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for class modifiers (final, abstract, readonly) in extensions

1 participant