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

php.internals

Máté Kocsis

5 years ago
Hi Internals, I've just finished the first iteration of the RFC ( https://wiki.php.net/rfc/internal_method_return_types) as well as the implementation based on the feedback Nikita and Nicolas provided. Thus, I'd like to start the discussion phase. Regards: Máté

Nicolas Grekas

5 years ago
Hello Maté, https://wiki.php.net/rfc/internal_method_return_types) as well as the
> implementation based on the feedback Nikita and Nicolas provided.
Thanks for moving this topic forward, it's very much needed. I like the word "tentative" you're using to describe the missing return types. I would be good with the RFC but I want to give a few different ideas to challenge it a bit. Here they are: - About using "E_STRICT", I'm not really sold. I think these notices should follow the same path as deprecations as far as reporting is concerned. By using E_STRICT, many error handlers will throw exceptions, while the code is fine really. Deprecations don't lead to exceptions usually (at least they never do in any Symfony stack). Semantically, a deprecation fits well to me also. - Suppressing the notice is very much needed, but I think we can merge the corresponding attribute with the TentativeReturnType that you mention in "future scope". - As a corollary, we might not need the new methods on ReflectionMethod: instead, we might make getAttributes() return a TentativeReturnType attribute for internal methods too. To summarize my proposal, I think we need only one TentativeReturnType attribute, that we would put on internal methods, and that would also be allowed on userland methods. ReflectionMethod::gettAttributes() would report these attributes for both internal and userland methods. The attribute would need to convey the allowed types. This could be done with a list of strings. Taking your example from the RFC, this would look like this: class MyDateTime extends DateTime{ /** * @return DateTime|false */ #[TentativeReturnType(DateTime::class, 'false')] public function modify(string $modifier) { return false; }} In this example, this would duplicate the docblock, but many docblocks contain extended return-type info that the engine doesn't understand anyway (list of types, etc.) When engine sees these attributes, it would behave as you describe in the RFC, with one possible extension: it could also validate the supplied list of types and check LSP on it (when there is a parent type). Does this make sense to you? Nicolas

Claude Pache

5 years ago
> Le 6 mars 2021 à 23:56, Máté Kocsis <kocsismate90@gmail.com> a écrit : > > Hi Internals, > > I've just finished the first iteration of the RFC ( > https://wiki.php.net/rfc/internal_method_return_types) as well as the > implementation based on the feedback Nikita and Nicolas provided. Thus, I'd > like to start the discussion phase. > > Regards: > Máté
Hi, Two remarks: (1) The RFC is about return type of non-final methods. The same issue might arise for typed properties, whose type are supposed to be invariant under inheritance; although it is admittedly rarely useful to redeclare them in the subclass. Should typed properties be handled in the same way, or should we simply recommend to not redeclare properties? (2) Nicolas Grekas has beaten about E_STRICT (E_DEPRECATED is fine in this case). I’m just adding this: By reintroducing E_STRICT you are effectively reverting the [Reclassify E_STRICT notices] RFC, whose motivation was to “simplify our error model and resolve the currently unclear role of strict standards notices”. Thus, you should propose a clear role of those resurrected E_STRICT notices, that justifies the complication of the error model. [Reclassify E_STRICT notices]: https://wiki.php.net/rfc/reclassify_e_strict —Claude

Máté Kocsis

5 years ago
Hi Nicolas and Claude, First of all, thanks for your comments! Let me answer them one by one: 1.) A few other people off-list also shared their negative feelings about the E_STRICT. So I'm ok to use E_DEPRECATED instead. Now that I implemented the suppressing mechanism, I think using a separate error type is not needed anymore that much. 2.) Unifying the TentativeReturnType and SuppressReturnTypeNotice attributes is an interesting idea, and I would love to get rid of the latter one. Although, my concern is that doing so would eliminate the possibility for an overriding method to declare its own native return types (it's possible that they've already defined return types): so any child class could literally define return types at its own will, while it was not possible to do before. I'm eager to listen to any solution that would address my concerns. :) 3.) I'm not sure you noticed in the PR, but in fact, I also implemented the TentativeReturnType attribute. Currently, it can be used as below when DateTime::modify() is overridden to return the ?DateTime type: class MyDateTime extends DateTime { #[TentativeReturnType] public function modify(string $modifier): ?DateTime { return null; } } How does this syntax look like for you? Compared to your proposal, the main difference is that the attribute doesn't itself store any type information, but it's done among the function information as normally. In my opinion, the current implementation has multiple advantages over the one you proposed: - As far as I can tell, it would be *very* cumbersome to parse and validate type information from strings, rather than reusing the capabilities we already have. But I'd be happy to be corrected if I'm wrong. - Apart from the compiler itself, I think parsing type info is more straightforward as currently implemented for users as well as any tooling - We should also think about people who already declared return types for overriding methods. I don't see any good reason why they should repeat this information in the attribute. - I'm also not sure how the attribute could be used to retrieve the tentative type? Should it return a ReflectionType? Returning just the string representation seems like subideal for me. 4.) Claude, I think you make a good point! So non-private, untyped properties could be converted to typed properties a little bit more gradually if we made this "tentative" type mechanism available for properties as well. Coincidentally, I recently came up with the idea that I'd like to fix type issues with internal class properties (e.g. lots of them don't respect the strict_types directive), and I also thought about migrating them to typed properties for PHP 9.0. All in all, I don't want to include properties in the current proposal, but I'd probably work on it next time. Regards: Máté Claude Pache <claude.pache@gmail.com> ezt írta (időpont: 2021. márc. 8., H, 16:19):

Nicolas Grekas

5 years ago
Hi Máté, 1.) A few other people off-list also shared their negative feelings about
> the E_STRICT. So I'm ok to use E_DEPRECATED instead. > Now that I implemented the suppressing mechanism, I think using a separate > error type is not needed anymore that much. >
Wonderful!
> 2.) Unifying the TentativeReturnType and SuppressReturnTypeNotice > attributes is an interesting idea, and I would love to get > rid of the latter one. Although, my concern is that doing so would > eliminate the possibility for an overriding method to declare > its own native return types (it's possible that they've already defined > return types): so any child class could literally define > return types at its own will, while it was not possible to do before. I'm > eager to listen to any solution that would address my concerns. :) >
I'm not sure I get your concern: how would #[TentativeReturnType] conflict with native return types? I didn't think about it, but #[TentativeReturnType] could be useful to raise a deprecation when a supertype wants to tell child classes that's is going to tighten its return type, and that they should do so if theirs is too broad. This is basically a generalization of what we're talking about, isn't it?
> 3.) I'm not sure you noticed in the PR, but in fact, I also implemented > the TentativeReturnType attribute. Currently, it can be used > as below when DateTime::modify() is overridden to return the ?DateTime > type: > > class MyDateTime extends DateTime > { > #[TentativeReturnType] > public function modify(string $modifier): ?DateTime { return null; } > } > > How does this syntax look like for you? > > Compared to your proposal, the main difference is that the attribute > doesn't itself store any type information, but it's done among the > function information as normally.
Oh, I didn't get this at first: you're telling that this native return type would not be enforced when the attribute is declared? This should answer my previous comment. I'm not sure yet this is a good idea, because it would prevent userland libs from using this attribute in an effective way until they bump to 8.1...
> In my opinion, the current implementation > has multiple advantages over the one you proposed: > - As far as I can tell, it would be *very* cumbersome to parse and validate > type information from strings, rather than reusing the > capabilities we already have. But I'd be happy to be corrected if I'm > wrong. >
- Apart from the compiler itself, I think parsing type info is more
> straightforward as currently implemented for users as well as any tooling >
Maybe Nikita can shed some light on this (the 1st item mainly)?
> - We should also think about people who already declared return types for > overriding methods. I don't see any good reason why they > should repeat this information in the attribute. >
In my proposal, the path for userland would be: - in their next minor (still supporting PHP < 8.1): add the attribute; - in their following major: user a native return type and remove the attribute.
> - I'm also not sure how the attribute could be used to retrieve the > tentative type? Should it return a ReflectionType? Returning > just the string representation seems like subideal for me. >
It would contain a list of strings in my proposal, to keep things boring and expected yes. Nicolas

Máté Kocsis

5 years ago
Hi Nicolas,
> Oh, I didn't get this at first: you're telling that this native return > type would not be enforced when the attribute is declared? This should > answer my previous comment. >
Yes, that's the case. On one hand, this solution IMO has the advantage that its syntax integrates into the ecosystem much better, including php-src itself (as I mentioned in my previous mail). On the other hand, it might be a little bit deceptive at first that the type declaration is not enforced when the attribute is present. Nonetheless, I still prefer this solution over storing types as a list of strings. I'm not sure yet this is a good idea, because it would prevent userland
> libs from using this attribute in an effective way until they bump to 8.1...
The main proposal is about adding return types to internal methods, and the SuppressReturnTypeNotice attribute can already be added to any libraries. But you are right in connection with the TentativeReturnType attribute, libraries would have to bump their minimum PHP version requirement to 8.1 in order to be able to add return types without a BC impact on PHP <8.1. I think it's still the less bad option. As this RFC's primary motivation is to prepare for adding return types to internal methods, I'm planning to add a secondary vote about exposing tentative return types to userland, since I'm not 100% confident that this concept is worth the special care in PHP itself. Máté

Máté Kocsis

5 years ago
Hi, 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) As the 2 weeks of discussion has already passed, I'd like to start the vote in the near future, unless any major concern arises. So it's the best time to bring these concerns up. :) Máté

Nicolas Grekas

5 years ago
> > 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?

Máté Kocsis

5 years ago
> 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. >
Yes, I think I agree, but I'd be curious about Nikita's opinion as well, since he brought up this problem first.
> 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. >
If we get rid of the userland part of my proposal, then I think we can really rename SuppressReturnTypeNotice to TentativeReturnType.
> As a corollary, adding this attribute should conflict with having a real > return type.
This is the only questionable part for me, because then this RFC would cause more trouble for overriding methods which already define a wrong return type: a deprecation notice would always be triggered for them on PHP 8.1+ until return types are fixed or removed. And as we discussed it previously, fixing them is not always possible. Or is there any specific reason I'm not aware of why you favor this behavior? Máté

Nicolas Grekas

5 years ago
> 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. >> > > Yes, I think I agree, but I'd be curious about Nikita's opinion as well, > since he brought up this problem first. > > >> 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. >> > > If we get rid of the userland part of my proposal, then I think we can > really rename SuppressReturnTypeNotice > to TentativeReturnType. >
This would mean that the RFC could describe how userland (code analyzers) should understand the TentativeReturnType when encountering one, without asking anything from the engine when base userland classes are extended. For internal classes, the attribute would just mean what you wrote already. That'd be fine to me.
> As a corollary, adding this attribute should conflict with having a real >> return type. > > > This is the only questionable part for me, because then this RFC would > cause more trouble for overriding methods > which already define a wrong return type: a deprecation notice would > always be triggered for them on PHP 8.1+ > until return types are fixed or removed. And as we discussed it > previously, fixing them is not always possible. > Or is there any specific reason I'm not aware of why you favor this > behavior? >
To me, overriding methods that define a wrong return type should remove their return type as a fix, and replace it with the attribute. Removing a return type is allowed by LSP, so this should be just fine. Nicolas

Nikita Popov

5 years ago
On Sat, Mar 6, 2021 at 11:56 PM Máté Kocsis <kocsismate90@gmail.com> wrote:
> Hi Internals, > > I've just finished the first iteration of the RFC ( > https://wiki.php.net/rfc/internal_method_return_types) as well as the > implementation based on the feedback Nikita and Nicolas provided. Thus, I'd > like to start the discussion phase. > > Regards: > Máté >
Thanks Máté for the RFC, and thanks Nicolas for your comments. I think it's worth noting that this RFC tries to address a specific case of a more general problem: PHP's strict LSP checks make it hard to change method signatures, in ways that may be perceived as harmless. I think the two important ones are: 1. The one addressed by the RFC is addition of a return type (or more generally, restriction of a return type). This is generally done when the method was already guaranteed to return that type, and this fact was not explicitly declared previously. Direct users of the API are not affected by the change. Overriding methods can be affected in two ways: They made use of the lose API contract and returned a different type, in which case the implementation needs to be changed. Or, and this is almost always the case, they already adhere to the stricter API contract, but now need to explicitly declare this fact. 2. The second one not addressed here is the addition of optional parameters. Take for example the recent change of mysqli::execute() to mysqli::execute(?array $params = null). Once again, direct users of the API are not affected by the change. Overriding methods are affected because they need to pass through the new parameter. As this is an addition of a new optional feature, not passing through the optional parameter only becomes a problem if the new optional feature is actually used. Whether not passing it is "harmless" depends on whether the API declarer and the API user are the same. The commonality is that both of these changes have no impact on direct API consumers, only on inheritors (to give a counter example: Adding a new required parameter breaks direct consumers). In both cases it is technically easy to adjust the overriding APIs to comply with the new signature -- the problem is purely one of backwards compatibility guarantees provided to downstream consumers. Having said all that, I don't really see a solution for the general problem, short of allowing methods to opt-out of LSP checks entirely. I think doing so would be a very bad idea, because the functionality would certainly get misused for other purposes. As such, let's get back to the return types... I think as far as the original motivation is concerned (adding return types to internal methods), the RFC as proposed does well. The only thing I would change is to add the ReflectionMethod::getTentativeReturnType() part independently of the userland aspect. I believe it's important that this is exposed in reflection, even if the more general userland functionality is not provided. For example, if you have a mock generator, you'll probably want to either add the tentative return type as a real return type to mocks, or at least automatically add the #[SuppressReturnTypeNotice] attribute. I'm more ambivalent about the userland side of this proposal. As Nicolas has already pointed out, the RFC as proposed requires the library to have a PHP 8.1 minimum version requirement to make use of this functionality. And libraries requiring PHP 8.1 are likely not the target audience for this feature -- at least not when it comes to adding return types at all, there might still be a use when it comes to changing them in the future, as typesystem capabilities are expanded. I don't think it makes sense to introduce any solution in this space that requires PHP 8.1. If we introduce something for the userland side of things, then it should be compatible with older versions. Nicolas' suggestion of declaring the new return type inside the attribute #[TentativeReturnType("Foo|Bar")] would certainly work, and allow us to provide the same degree of functionality as the internal variant. That is, we could perform a variance check against the new tentative signature and throw a deprecation notice on mismatch. However, just like Máté, I don't really look forward to parsing information out of type strings. It's manageable now, but keeping in mind future extensions of the typesystem, dealing with #[TentativeReturnType("callable(Foo<T : int|string> &...)")] will be significantly less pleasant. That leaves Nicolas' last suggestion of not even trying to specify the type in a way that is understood by the engine -- just indicate that the type is going to change, and leave the actual type specification to @return. In this case the attribute would not have any actual effect from the engine perspective (apart from the interaction with the internal case). Which begs the question, why does this need to be part of PHP core at all? Is it just a matter of standardizing on a particular attribute? If we go down that route, I would suggest not to call this #[TentativeReturnType], but something like #[ReturnTypeWillChange]. I also don't think it's necessary to restrict this to methods that don't currently declare a return type, as it may be necessary to narrow a declared return type at a later time (e.g. due to typesystem improvements). For example: class A { /** @return int[] */ #[ReturnTypeWillChange] public function method(): array {} } class B extends A { // Accepted, static analyzers happy. public function method(): int[] {} } class C extends A { // Accepted, but static analyzers will warn. public function method(): array {} } class D extends A { // Not accepted, as it violates the proper array type. public function method() {} } So tl;dr I would either go with only the internal part of the proposal, or follow Nicolas' last suggestion, or some variant thereon. The version that's currently RFC doesn't seem particularly useful due to the version requirement. Regards, Nikita

Pierre

5 years ago
Le 14/04/2021 à 15:30, Nikita Popov a écrit :
> 1. The one addressed by the RFC is addition of a return type (or more > generally, restriction of a return type). This is generally done when the > method was already guaranteed to return that type, and this fact was not > explicitly declared previously. Direct users of the API are not affected by > the change. Overriding methods can be affected in two ways: They made use > of the lose API contract and returned a different type, in which case the > implementation needs to be changed. Or, and this is almost always the case, > they already adhere to the stricter API contract, but now need to > explicitly declare this fact. > > 2. The second one not addressed here is the addition of optional > parameters. Take for example the recent change of mysqli::execute() to > mysqli::execute(?array $params = null). Once again, direct users of the API > are not affected by the change. Overriding methods are affected because > they need to pass through the new parameter. As this is an addition of a > new optional feature, not passing through the optional parameter only > becomes a problem if the new optional feature is actually used. Whether not > passing it is "harmless" depends on whether the API declarer and the API > user are the same.
Hello, Having type-inference wouldn't transparently fix some of these issues ? Let's consider a method such as foo($array) which returns a bool or a string, for example. And suddenly, the types get specified as foo(?array $array): bool|string. With type inference, an implementer which has correctly implemented an override this signature would inherit from types if non-specified, and wouldn't have anything to fix ? This is just a stupid idea, but I'd love that, not having to repeat all types when implementing method interfaces or overriding methods, and just trust the compiler and or engine runtime for inferring types when checking it, and do it in a smart and robust way so that invalid code cannot compile or run, but valid code be easier and quicker to read. But sorry for the noise, I'm deviating from the original issue. Cheers,

Máté Kocsis

5 years ago
Hi Pierre, Having type-inference wouldn't transparently fix some of these issues ?
> > Let's consider a method such as foo($array) which returns a bool or a > string, for example. And suddenly, the types get specified as foo(?array > $array): bool|string. >
PHP doesn't have such an advanced type inference capability: just consider dynamic calls, or regular function invocations where the return type information is not available. On the other hand, we could add return types implicitly, as it was proposed earlier, but I didn't really like this solution. For a little more details, have a look at my initial message: https://externals.io/message/112625#112625 Besides, I think it's better to document the return types explicitly as a declaration, since they usually help during implementation. Máté

Pierre

5 years ago
Le 20/04/2021 à 11:44, Máté Kocsis a écrit :
> Hi Pierre, > PHP doesn't have such an advanced type inference capability: just consider > dynamic calls, or regular function invocations > where the return type information is not available.
Yes I know it doesn't have it, it was a subtle way of asking if one day, the compiler may have inferences capabilities. I know it's not really possible until it continues loading code dynamically at runtime, but in some scenarios (such as preload, or inherited/implemented class type checking) it may be possible, I'm only hard guessing here
> On the other hand, we could add return types implicitly, as it was proposed > earlier, but I didn't really like this solution.
Return types being added automatically really looks like inference already, just a simple one, I guess. I'd love it. In all inheritance or interface implementation scenarios, it seem possible, since the compiler needs to load the implemented or inherited class code to be able to compile the current class. Any good IDE that knows PHP does the job would it also and be able to detect errors with that.
> For a little more details, have a look at my initial message: > https://externals.io/message/112625#112625 Besides, I think > it's better to document the return types explicitly as a declaration, since > they usually help during implementation. > > Máté
Thanks for your answer. Regards,
-- Pierre

Máté Kocsis

5 years ago
> Yes I know it doesn't have it, it was a subtle way of asking if one day, > the compiler may have inferences capabilities. I know it's not really > possible until it continues loading code dynamically at runtime, but in > some scenarios (such as preload, or inherited/implemented class type > checking) it may be possible, I'm only hard guessing here >
Preloading can help a little bit, but still, the possible return types of all the calls have to be inferrable at compile-time in all the affected code paths. It seems pretty much unfeasible for me in most of the cases. Return types being added automatically really looks like inference
> already, just a simple one, I guess.
Indeed, internal method return types were "inferred" based on their implementation, but this was done manually, and we documented them in the so called stubs. It's also an extremely slow way of "inference", since the whole project took more than a year. ^^
> I'd love it. In all inheritance or > interface implementation scenarios, it seem possible, since the compiler > needs to load the implemented or inherited class code to be able to > compile the current class. >
If return types were added implicitly, then you would get a diagnostic each time a function returns an incorrect value, so the error log messages could easily go out of control. Besides, you would also need a good IDE to be able to know the exact return type, which is a bit cumbersome if you only scroll through the code on web platforms like GitHub. Máté

Máté Kocsis

5 years ago
Thank you, Nikita, for the wise wrap-up about the general problem and the possible solutions! I think as far as the original motivation is concerned (adding return types
> to internal methods), the RFC as proposed does well. The only thing I would > change is to add the ReflectionMethod::getTentativeReturnType() part > independently of the userland aspect. I believe it's important that this is > exposed in reflection, even if the more general userland functionality is > not provided. For example, if you have a mock generator, you'll probably > want to either add the tentative return type as a real return type to > mocks, or at least automatically add the #[SuppressReturnTypeNotice] > attribute. >
Initially, the reflection-related changes were a core part of the RFC, but since I didn't find a really good use-case for ReflectionMethod::getTentativeReturnType(), I moved it to the secondary part. I think your example highlights really well that it's needed indeed, I've just put it back to the core proposal.
> I'm more ambivalent about the userland side of this proposal. As Nicolas > has already pointed out, the RFC as proposed requires the library to have a > PHP 8.1 minimum version requirement to make use of this functionality. And > libraries requiring PHP 8.1 are likely not the target audience for this > feature -- at least not when it comes to adding return types at all, there > might still be a use when it comes to changing them in the future, as > typesystem capabilities are expanded. >
I agree here as well, as neither I am a fan of the current implementation. Especially after you made me realize that it doesn't even solve the general problem completely... That being said, I've just got rid of the userland-related part of the RFC, since this is something somebody can implement later after giving some more thought for the feature. Now that the controversial part has been removed from the RFC, I'd like to start the vote shortly (late next week), in case there is not any more feedback. Finally, I didn't rename the SuppressReturnTypeNotice attribute, but I'm open to do so if you strongly prefer TentativeReturnType of ReturnTypeWillChange (although I like the latter one more). Máté

Nicolas Grekas

5 years ago
> Thank you, Nikita, for the wise wrap-up about the general problem and the > possible solutions! > > I think as far as the original motivation is concerned (adding return types > > to internal methods), the RFC as proposed does well. The only thing I > would > > change is to add the ReflectionMethod::getTentativeReturnType() part > > independently of the userland aspect. I believe it's important that this > is > > exposed in reflection, even if the more general userland functionality is > > not provided. For example, if you have a mock generator, you'll probably > > want to either add the tentative return type as a real return type to > > mocks, or at least automatically add the #[SuppressReturnTypeNotice] > > attribute. > > > > Initially, the reflection-related changes were a core part of the RFC, but > since I didn't find a really good use-case > for ReflectionMethod::getTentativeReturnType(), I moved it to the secondary > part. I think your example highlights really well that it's needed indeed, > I've just put it back to the core proposal. > > > > I'm more ambivalent about the userland side of this proposal. As Nicolas > > has already pointed out, the RFC as proposed requires the library to > have a > > PHP 8.1 minimum version requirement to make use of this functionality. > And > > libraries requiring PHP 8.1 are likely not the target audience for this > > feature -- at least not when it comes to adding return types at all, > there > > might still be a use when it comes to changing them in the future, as > > typesystem capabilities are expanded. > > > > I agree here as well, as neither I am a fan of the current implementation. > Especially after you made me realize that it doesn't even solve the general > problem completely... That being said, I've just got rid of the > userland-related part of the RFC, since this is something somebody can > implement later after giving some more thought for the feature. > > Now that the controversial part has been removed from the RFC, I'd like to > start the vote shortly (late next week), in case there is not any more > feedback. Finally, I didn't rename the SuppressReturnTypeNotice attribute, > but I'm open to do so if you strongly prefer TentativeReturnType of > ReturnTypeWillChange (although I like the latter one more). >
I strongly prefer either TentativeReturnType or ReturnTypeWillChange yes (ReturnTypeWillChange would work for me.) They're more declarative and can be re-used by userland without a need for any RFC from internals. Actually, I plan to use them in Symfony to help us add return types asap. Once this is changed in the RFC, I'll be +1 on it. Thanks for doing the hard work, Nicolas

Máté Kocsis

5 years ago
> > I strongly prefer either TentativeReturnType or ReturnTypeWillChange yes > (ReturnTypeWillChange would work for me.) >
Alright, I've just changed it for ReturnTypeWillChange. Máté