Re: [VOTE] [RFC] Final anonymous classes
| From: | Nikita Popov | Date: | Sun, 03 Dec 2023 15:42:05 +0000 |
| Subject: | Re: [VOTE] [RFC] Final anonymous classes | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121912@lists.php.net to get a copy of this message | ||
On Sun, Dec 3, 2023, at 16:05, Nicolas Grekas wrote:
> Hello Nikita,
>
>> > I've just opened voting for the final anonymous classes RFC @
>> > https://wiki.php.net/rfc/final_anonymous_classes.
>> >
>> > Voting started now, and will run until December 18th 2023, 00:00 GMT.
>>
>> For the record, I've voted against this proposal because I believe it should have gone
>> with option 2, that is to *always* make anonymous classes final.
>>
>> It makes very little sense to me that everyone needs to explicitly mark their anonymous
>> classes as final just because there is a class_alias loophole that could, in theory, have been used
>> to extend anonymous classes in the past. Especially given that there is no evidence of this
>> "feature" being used in the wild (or if there is such evidence, it was not presented in
>> the proposal).
>
> You might have missed my message in the discussion thread,
>
> see https://externals.io/message/121685#121690
>
> There is such evidence (not in the RFC though).
Thanks, I did indeed miss this. However, I also don't think that a test-only use is
particularly compelling. If this were something that Symfony had exposed as a public API promise, we
might be caught between a rock and a hard place, but this thankfully doesn't seem to be the
case.
I think I can fairly confidently say that the ability to extend anonymous classes by abusing
class_alias is a bug in the original implementation, rather than an intentional feature. Yes, people
do start to depend on bugs if they exist for long enough, but I don't think this means we
shouldn't fix them (within the bounds of pragmatism).
Regards,
Nikita