Re: [RFC] [Vote] Adding return types to internal methods

From: Date: Thu, 03 Jun 2021 14:54:55 +0000
Subject: Re: [RFC] [Vote] Adding return types to internal methods
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-114712@lists.php.net to get a copy of this message
On Thu, Apr 22, 2021 at 9:42 AM Máté Kocsis <kocsismate90@gmail.com> wrote:

> Hi Internals,
>
> I've just opened the vote about
> https://wiki.php.net/rfc/internal_method_return_types
> and I will close it on 2021-05-06.
>
> For prior discussion, please see https://externals.io/message/113413
>
> Regards:
> Máté
>

One implication that I didn't fully appreciate is that this also applies to
interfaces. The migration to tentative return types hasn't finished yet,
but we already have

interface JsonSerializable {
    function jsonSerialize(): mixed;
}

Which requires implementers of that interface to also specify "mixed" or a
subtype of "array" in the implementation. I expect that there will also be
at least

interface Countable {
    function count(): int;
}

This feels a bit different than the class case, in that implementing
internal interfaces is common, while extending internal classes is mostly
an artifact of us not adding enough "final"s in the early days.

I'm okay with this, but wanted to point it out.

Regards,
Nikita


Thread (13 messages)

« previous php.internals (#114712) next »