Re: Allow hooks in `readonly` promoted properties
| From: | Tim Düsterhus | Date: | Mon, 09 Jun 2025 14:53:35 +0000 |
| Subject: | Re: Allow hooks in `readonly` promoted properties | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-127631@lists.php.net to get a copy of this message | ||
Hi
Am 2025-06-04 15:39, schrieb Nick:
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üsterhusYour 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 thehttps://github.com/php/php-src/pull/18757/files#diff-fdc22521b074231ac6de0df97aeb23a4759ad9b668d3b9ed3fedf8727f5795a4R21 It checks re-assignment, and expects:readonlycheck comes before the visibility check, which would imply that thereadonlydoesn't have an effect: https://3v4l.org/nqgpLCannot modify protected(set) readonly property Test1::$prop from global scopeIt’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?