[RFC] Allow #[\Override] on class constants#20478
Open
DanielEScherzer wants to merge 8 commits into
Open
Conversation
Member
Author
|
Someone at MergePHP suggested this today, I'll write up the RFC when I have a chance |
f5fdc15 to
fc3124d
Compare
33a3179 to
f89b1f0
Compare
f89b1f0 to
4c749b6
Compare
44e5335 to
3f0f1d1
Compare
TimWolla
reviewed
Jun 29, 2026
TimWolla
left a comment
Member
There was a problem hiding this comment.
Looks correct, except for test remark. But please have someone else double-check the engine implementation.
Comment on lines
+29
to
+31
| #[\Override] | ||
| public const C1 = 'C1'; | ||
| public const C2 = 'C2'; |
Member
There was a problem hiding this comment.
C2 is not tested at all. The original Zend/tests/attributes/override/001.phpt test specifically had 4 cases to test all situations:
- p1: Override in PP and C.
- p2: Override in C, implementation in PP.
- p3: Override in PP.
- p4: Override in C, implementation in P.
Member
Author
There was a problem hiding this comment.
I added the cases from the origin test file which I think now covers everything
d1ac360 to
9af924d
Compare
Member
Author
|
Rebased onto latest master |
iluuu1994
approved these changes
Jun 30, 2026
iluuu1994
left a comment
Member
There was a problem hiding this comment.
I'm very sorry for the big delay. Some things got in the way yesterday.
Only a nit. The implementation looks correct. Too many tests for my taste.
iluuu1994
reviewed
Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://wiki.php.net/rfc/override_constants