Skip to content

Fix GH-10377: Unable to have an anonymous readonly class #10381

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

Conversation

nielsdos
Copy link
Member

Fixes GH-10377

This fixes the oversight that an anonymous class should be able to be readonly. Other identifiers such as final and abstract do not make sense. As we still want nice errors for when users try to use these modifiers, or use multiple modifiers, we introduce a new function zend_add_anonymous_class_modifier that will perform verification for anonymous class modifiers, just like zend_add_class_modifier does for non-anonymous classes.

@kocsismate
Copy link
Member

kocsismate commented Jan 20, 2023

Nice, the PR looks good to me! However, IMO we should fix this in master only as this is not a bug per se, but a missing feature caused by an oversight when I implemented the RFC. Feel free to ask the RMs what they think if you disagree :) If we arrive to a consensus, I'll merge your work.

@nielsdos
Copy link
Member Author

Thank you for your review.
The reason I targeted 8.2 is because the issue was labeled as a bug. But I'm fine too with targeting the master branch :)

@nielsdos nielsdos changed the base branch from PHP-8.2 to master February 1, 2023 20:56
@nielsdos
Copy link
Member Author

nielsdos commented Feb 1, 2023

Since no more replies came in, and I agree with your decision: I changed the target to master and rebased on top of master.

Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

This fixes the oversight that an anonymous class should be able to be
readonly. Other identifiers such as final and abstract do not make
sense. As we still want nice errors for when users try to use these
modifiers, or use multiple modifiers, we introduce a new function
zend_add_anonymous_class_modifier that will perform verification for
anonymous class modifiers, just like zend_add_class_modifier does for
non-anonymous classes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to have an anonymous readonly class
3 participants