Hi

Am 2025-06-04 15:39, schrieb Nick:
Your test cases really only scratch the surface of what should be tested. You are basically just verifying that it compiles. In fact you are not even testing that reassigning the property is disallowed, because the test fails due to a visibility error. In fact it appears that the `readonly` check comes before the visibility check, which would imply that the `readonly` doesn't have an effect: https://3v4l.org/nqgpL

https://github.com/php/php-src/pull/18757/files#diff-fdc22521b074231ac6de0df97aeb23a4759ad9b668d3b9ed3fedf8727f5795a4R21

It checks re-assignment, and expects:

Cannot modify protected(set) readonly property Test1::$prop from global scope

It’s tested for readonly props, readonly class and promoted properties.

Correct me, but this is what you are talking about, isn't it? Anything else you are missing?

Your link to GitHub is dead (probably due to the force-pushes), but the tests in the current version of the PR resolved my question by attempting to re-assign from within the class (such that visibility is not the cause of the error).

Best regards
Tim Düsterhus

Reply via email to