On Tue, Mar 3, 2020 at 8:01 AM Nikita Popov <nikita....@gmail.com> wrote:
>
> On Fri, Feb 7, 2020 at 11:32 AM Nikita Popov <nikita....@gmail.com> wrote:
>
> > Hi internals,
> >
> > I've sent a mail about this before, but as this turned into a bit of a
> > larger change (also allowing "abstract private" methods in traits) and
> > there's some backwards compatibility impact, I've created a proper RFC for
> > this:
> >
> > https://wiki.php.net/rfc/abstract_trait_method_validation
> >
>
> Based on Nicolas' feedback, I've adjusted the RFC to not validate the
> visibility of the method (only the signature and "static-ness"). The reason
> is outlined in the last paragraph of the Proposal section.
>
> With that done, I plan to open voting on this tomorrow, unless something
> new comes up.
>
> Regards,
> Nikita

To clarify, this the signature enforcement is only applied to abstract
methods that come from traits, correct? This code will remain valid?

```
trait CompareHelper {
  function compareTo($obj): bool {}
}

class C1 {
  use CompareHelper;
  function compareTo(self $obj) {}
}
```

Notably, non-abstract methods will be able to change argument counts,
their type, the return type, all without restriction. Correct? I don't
particularly like code like this, but I've seen it out there on more
than one occasion.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to