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

From: Date: Mon, 22 Mar 2021 12:32:12 +0000
Subject: Re: [RFC] [Discussion] Adding return types to internal methods
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-113664@lists.php.net to get a copy of this message
>
> I've updated the RFC with the following things:
> - The proposed error level is now E_DEPRECATED instead of E_STRICT
> - I added a new section for exposing the behavior to userland (this is a
> separate vote)
>

To build on your approach and mixing it with the need we discussed for
userland, I have a new proposal:

We should replace the SuppressReturnTypeNotice by the TentativeReturnType
one right away.
The TentativeReturnType would mean: "I'm going to add a return type to this
method in its next major".
As a consequence, for child classes of internal methods, this would
suppress the notice.
For userland, there are already ways to declare the planned return type
(aka @return in phpdoc), so we might not need any new way to declare this
from the engine pov.
As a corollary, adding this attribute should conflict with having a real
return type.

That would allow userland libs to immediately adopt the tag and be ready
for PHP 8.1.

WDYT?


Thread (18 messages)

« previous php.internals (#113664) next »