On Fri, May 29, 2020 at 6:45 PM Gabriel Caruso <carusogabrie...@gmail.com> wrote:
> Hello, internals! > > I have opened the voting for > https://wiki.php.net/rfc/magic-methods-signature. > > The voting period ends on 2020-06-19 at 18h (CEST). > The RFC is a bit unclear on what is actually being proposed. It says > This RFC proposes to add parameter and return types checks per the following details. and goes on to list (reasonable looking) magic method signatures, but does not say how exactly those types are going to be checked. Is this going to require exactly the same signature, or is this going to be in accordance with variance rules? For example, are all of the following signatures valid under this RFC? Only the first two? None of them? // Narrowed return type from ?array public function __debugInfo(): array {} // Narrowed return type from mixed public function __get(string $name): int {] // Widened argument type from string public function __get(string|array $name): mixed {} Also, is omitting the return type still permitted, even though it would nominally violate variance? public function __debugInfo() {} Finally, if omitting the return type is permitted, will an implicit return type be added, like we do for __toString()? Would the method automatically become public function __debugInfo(): ?array {} and report as such from reflection? Nikita