Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110320 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 97290 invoked from network); 31 May 2020 15:15:41 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 31 May 2020 15:15:41 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8EA87180211 for ; Sun, 31 May 2020 06:57:06 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 31 May 2020 06:57:06 -0700 (PDT) Received: by mail-lj1-f174.google.com with SMTP id u10so3614665ljj.9 for ; Sun, 31 May 2020 06:57:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=O/1k09A4yoRMFMarneR0zAwVQZNaOalxfPCeLNsxdgQ=; b=Sk+lMv6mxhjiZgk/SkJOXBrUQ/pryJS50kb1GnU7h96MlCvG02ufoeUqsB8ZIB3tUX mQ1VGErnCcGxd03Pxbzw7Ps3ny1O1v0uEAmy73ji9yCNH4ct5K9OpA5RQ9ikt0amfpM6 3yYAbeoBSYdgQz48pfF5WbNERoIn1vqZGCY1ONtpkt9XUTMkFqUKPYOeEHlW0ZrTHcEW XzQLoNwuCXqaJ4TC7qvXBSglfgHLEoYx0Kw2GtmIoIR/5h4/73qHUfgC4akwk+H7rpUC vkgFDsxlHm94MoIIctOCaXbnjagPpy+J2bp7cLnqDhGvSF1qAl9m1tatxbhIUbCnm7yY S32w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=O/1k09A4yoRMFMarneR0zAwVQZNaOalxfPCeLNsxdgQ=; b=ghJun6s+xCoJHfsL2osAkDfH5Qc+5IyjqfEZyIC+31LqXH+WkiEnIWl4JKMqIpsUFw 0uuu98m6h7P/aIS9ARapbITfEfDboGeyOxuwb3WVDm0N/oD42vcBLSnPTC5oDNGXkkqh Wwq6cZLPegiCjT3tylzQGQwJNOaB5n8CRq+Pwx9/uqe0/dESVfaxd0CJhYB9t8bLJQZc eJWHDes39g+1fiK/nZKb9FXc29xJedZn/9lZaJb7UitLK59ss0kNg7Qp79CDOiofML4V ccUW3LzDPhQ4NwQDa1H9LplIaBv1/MrzrCBRy9eaQxJZ9siqPwyWTHS2rkJYhqoGNT/D zPCQ== X-Gm-Message-State: AOAM531nexLrEpwwIuqWuo2jzAfyk3hQPebadNmeTixcdS8eCwQ6gwOO FilpS1bu4tQGGkpL5EhTpwNnRRM2wZu85A9tMtc= X-Google-Smtp-Source: ABdhPJwzMOrv4JT9HPeKD7UuA8luVmi+dbCkKLpRoCsqnSvw4QxxTET8nxuDgHbKDmNiV+Mw8wdayXLkles4Tv/uUZ4= X-Received: by 2002:a2e:9081:: with SMTP id l1mr9172762ljg.81.1590933423938; Sun, 31 May 2020 06:57:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 31 May 2020 15:56:47 +0200 Message-ID: To: Gabriel Caruso Cc: PHP Internals Content-Type: multipart/alternative; boundary="00000000000098605605a6f20d4a" Subject: Re: [PHP-DEV] [VOTE] Ensure correct signatures of magic methods From: nikita.ppv@gmail.com (Nikita Popov) --00000000000098605605a6f20d4a Content-Type: text/plain; charset="UTF-8" On Fri, May 29, 2020 at 6:45 PM Gabriel Caruso 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 --00000000000098605605a6f20d4a--