Skip to content

ext/reflection: Make properties readonly - #24282

Open
kamil-tekiela wants to merge 1 commit into
php:PHP-8.4from
kamil-tekiela:Reflection-readonly-properties
Open

kamil-tekiela wants to merge 1 commit into
php:PHP-8.4from
kamil-tekiela:Reflection-readonly-properties

Conversation

@kamil-tekiela

@kamil-tekiela kamil-tekiela commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Fixes #24147 alternative to #24153

It should not break BetterReflection.

@kamil-tekiela

Copy link
Copy Markdown
Member Author

@ndossche According to the test, this should still allow unset, even though I think it would be better not too. The BC changes are minimal here: the properties cannot be redeclared. As such, I think it may even go on PHP 8.4.

@Ocramius What is your opinion on this?

@Ocramius

Copy link
Copy Markdown
Contributor

even though I think it would be better not too

An alternative could be to interface the properties, FWIW - requires some more substantial changes.

unset() is the only mechanism I currently know of to allow shadowing a property with additional logic: if property accessors allow overriding a parent property, that's also a viable idea.

@Ocramius

Copy link
Copy Markdown
Contributor

BTW, if you want, just take the phpunit suite of BetterReflection for a spin on this branch: it is very detailed

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.

2 participants