Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115734 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 62591 invoked from network); 15 Aug 2021 07:53:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Aug 2021 07:53:15 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 79AB5180504 for ; Sun, 15 Aug 2021 01:24:55 -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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY 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-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) (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, 15 Aug 2021 01:24:54 -0700 (PDT) Received: by mail-io1-f45.google.com with SMTP id n24so971470ion.10 for ; Sun, 15 Aug 2021 01:24:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mirtes.cz; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=qIyrV5ioSzFQJWHeDjJxXR2jif/OeUnCO+XLWhOIv8g=; b=cozD+yQJAdywVoWBcqBsKrqZtC/62l+7+gIYWxlDSyPqVvJF+MX5z5xfNWTBp1sDVq TD9WDbrvg9r5gflp/9e9utirvF1jHgIeNXOEwtbmduG3f4ibNAIcZE9IaiPipKL4bhdL ql7X5+5HdT9P6lXq++bwsJtPdHiXVREzMM3c0= 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; bh=qIyrV5ioSzFQJWHeDjJxXR2jif/OeUnCO+XLWhOIv8g=; b=P0mvVR/Au+d3XotPifcN282FFhOUjf2hvlfH8IAdOeYhGHWAAlMSf00+m4oG3GP4R8 XUarQVi0EUunWCNLQXw+KRQuWECNl3kdZrDGKpe4Inryd6vn0JQPAiIkvEhmk72xKmUb ZseYwjmkn39uUWcoL2shQcULRKLt55qbmujcYxqxuWNVGG1lIKOYBv38+92uzeSi7enV S+/V9zuTvUELmmU4aZHDzE5S6TYsYncGTMWQ9N790KNd9jfWlQhXxOmPyCiRdZJ6TiXX 21vxAOZnIo2k6bMRQzX6U13iNmdjvgXwjtRhA4NSM2EGQSJqU8R0mNW04iNBJ59A5hEX yRVg== X-Gm-Message-State: AOAM530bwSehHMxBHuKItF2SmsgJEgi/Ku2ic7Aa0u6uLCVY0Of3T5L0 nc1u+/TWKLgbYcmuEeY9mDHSyQ60LK96CcKB1wYp//N0xpviXA== X-Google-Smtp-Source: ABdhPJzIH8Hwk6ic2v5CB3pv9NO779OIM+gDq8O3F8Z1vaUyohAK/cayQYKfHM8HbXk3thFrT80Ft4fUI+YYEdg7uLQ= X-Received: by 2002:a02:7094:: with SMTP id f142mr7194763jac.19.1629015894261; Sun, 15 Aug 2021 01:24:54 -0700 (PDT) Received: from 1064022179695 named unknown by gmailapi.google.com with HTTPREST; Sun, 15 Aug 2021 04:24:53 -0400 Received: from 1064022179695 named unknown by gmailapi.google.com with HTTPREST; Sun, 15 Aug 2021 04:24:49 -0400 Mime-Version: 1.0 (Mimestream 0.26.2) References: <64b3800a-c54e-c1cc-8bab-bc503a969c37@allenjb.me.uk> <954A89A5-97D4-491E-ABFC-CC2BE4FF87BA@newclarity.net> In-Reply-To: <954A89A5-97D4-491E-ABFC-CC2BE4FF87BA@newclarity.net> Date: Sun, 15 Aug 2021 04:24:53 -0400 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000b6172205c994d1e2" Subject: Re: [PHP-DEV] [RFC] Never For Argument Types From: ondrej@mirtes.cz (=?UTF-8?Q?Ond=C5=99ej_Mirtes?=) --000000000000b6172205c994d1e2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable It=E2=80=99s true that having =E2=80=9Cnever=E2=80=9D in a parameter type (= please use =E2=80=9Cparameter=E2=80=9D name for the method declaration, =E2=80=9Cargument=E2=80=9D is what you pas= s to a parameter when you call the method) would allow to use any type in an overriding method from contravariance/LSP point of view. But at the same time the interface with the =E2=80=9Cnever=E2=80=9D parameter type isn=E2=80=99t use= ful at all, because =E2=80=9Cnever=E2=80=9D cannot accept any type. Same as =E2=80=9Cnever=E2=80=9D in a return type means =E2=80=9Cthis functi= on never returns=E2=80=9D, =E2=80=9Cnever=E2=80=9D in a parameter type means =E2=80=9Cyou can never ca= ll this=E2=80=9D. That=E2=80=99s because if you have interface =E2=80=9CFoo" with method "doF= oo(never $a): void=E2=80=9D, you might be able to override it with =E2=80=9Cclass Bar imp= lements Foo=E2=80=9D and method =E2=80=9CdoFoo(A $a)=E2=80=9D, but at the same time it only allows y= ou to call =E2=80=9CBar::doFoo(new A())=E2=80=9D, it doesn=E2=80=99t allow you to call= =E2=80=9CFoo::doFoo(new A())=E2=80=9D. Which is probably not what people expect from a polymorphic method. So having the method on the interface =E2=80=9CFoo=E2=80=9D is completely usel= ess. Ond=C5=99ej Mirtes --000000000000b6172205c994d1e2--